Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Case Insensitive Comparison Write a function int icompare (std: string first, std: string second) which returns a negative number if the first string comes before

image text in transcribed

Case Insensitive Comparison Write a function int icompare (std: string first, std: string second) which returns a negative number if the first string comes before the second alphabetically, returns 0 if both strings are equal, and a positive number if the second string comes after the second alphabetically. This function should compare strings ignoring case differences, i.e. "Hello" = = "hello" or in other words icompare("Hello", "hello") ==0. Note: This function behaves similar to compare from the standard library. 20 points Find String Write a function bool contains(std::string reference, std::string value) which returns true if the reference string contains value within it. For example contains("Hello, World", "lo") true but contains("Hello, World", "lo Wo") false. Note: This function behaves just like contains from the standard library, however you may not use this function in your implementation. You may not use any of the find functions either

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions