Question: In C++ write a function recCStrCmp that must be recursive and will have three parameters. The first parameter is a cstring that will be compared
In C++
write a function recCStrCmp that must be recursive and will have three parameters. The first parameter is a cstring that will be compared to the second argument which is also a cstring. The third parameter is an index for what position is being evaluated within the two cstrings. If the characters at the same position are different based on the ascii chart you have your answer. This function should return the same characters as the strcmp function. This function should not change the contents of the cstrings. Cstring1 == cstring2 the function should return a 0. This includes ignoring the case on alphabetic characters only. Cstring1 < cstring2 the function should return a number less than 0. This includes ignoring the case on alphabetic characters only.
Example.
hello < HelP l < P ignoring case. Cstring1 > cstring2 the function should return a number greater than 0. This includes ignoring the case on alphabetic characters only.
Example: WINDOW > widow N > d
Strings answer subtraction using tolower
HELLO and hello answer is 0 \0 \0 = 0
Hello and helP answer is <0 l p 108 112 = 4
helP and hello answer is >0 P l 112 108 == 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
