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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started