Write a program in C++ using libraries. Write a function that allows case-insensitive comparison of two strings. 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! But also note that the strings should not be altered at all. Don't change the two string arguments before or during the call. Don't make copies and change the copies. All of this is terribly wasteful and/or destructive of data. Place your new function in a library (strextra?) and call it something useful (strcmp_ncase?). Write a driver program to test your function.
Write a program in C++ using libraries.
Write a function that allows case-insensitive comparison of two strings. 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!
But also note that the strings should not be altered at all. Don't change the two string arguments before or during the call. Don't make copies and change the copies. All of this is terribly wasteful and/or destructive of data.
Place your new function in a library (strextra?) and call it something useful (strcmp_ncase?).
Write a driver program to test your function.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps