Question: LANGUAGE C++ Write a function that allows case- in sensitive comparison of two strings. The strings should not be altered at all. The return value

LANGUAGE C++

Write a function that allows case-insensitive comparison of two strings. The strings should not be altered at all. The return value should be analogous to that from strcmp:

 s1 < s2 return something < 0 s1 == s2 return something == 0 s1 > s2 return something > 0 

(These return values can be short integers.)

Just remember that the comparisons are to be done in a manner that ignores the caseof the letters in the strings!

Place your new function in a library (strextra?) and call it something useful (strcmp_ncase?).

Write a driver program to test your function.

Add two defaulted arguments to your function which will allow the caller to request that you skip spaces and/or skip punctuation when doing the comparison.

Have numbers sorted properly even when they aren't justified with leading 0's:

 1 2 ... 9 10 

Instead of:

 1 10 2 ... 9 

Have numbers sorted properly even if they aren't in the lead of the string:

 a1 a2 ... a9 a10 b1 b2 ... 

Instead of:

 a1 a10 a2 ... a9 b1 b10 b2 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!