$29
Setup:
Create a project name hw9b inside your homework repository.
Download the hw9b.cpp from d2l and place inside the solution.
Add this file to your solution explorer.
Problem:
You need of a case insensitive compare for c++ strings. You must write this function as a recursive. If you find yourself writing a loop, you are not letting the recursion do its job.
This function will return the following values for a case insensitive compare
S1
== S2
0
S1
< S2
< 0 will be returned if s1[position] is less than s2[position] ignoring case
S1
> S2
> 0 will be returned if s1[position] is greater than s2[position] ignoring case
Think about when you the position goes beyond a string. Only do an insensitive compare when both characters are true for the isalpha function in cctype.
Requirements:
Must be a recursive function and pass all the tests include in the cpp file.
You must create 5 more test functions that you add to the section “My Test Cases”. Try and get the wrong answers. Place a comment above the CHECK stating why you are using this.
To get credit for this, you must have 5 valid test cases and pass the include tests and your own.
You will need to create additional strings for you test cases and add them to the catch test case section.
Hints:
Use the ascii chart to come up with interesting cases. Only generate test case that you can type at the keyboard when the program is run.
When you have two characters that are a-z or A-Z, consider using the tolower or toupper function to remove case sensitivity.