Question: Q4 Word match . This function will be employed in questions in exams/projects later in this course. . Write a function vord match to return


Q4 Word match . This function will be employed in questions in exams/projects later in this course. . Write a function vord match to return true for a match, false otherwise. bool vord match(string s1, string s2); . The definition of a "match" is as follows. 1. You may assume the strings s1 and s2 contain only one word each. 3. The match is case insensitive. . The following pairs are all positive matches and should all return true. 1. "Alice", "Alice'" 2. "Alice", "ALICE" 3. "Alice", "alice" 4. " alice ", "AlicE . The following pairs are all negative matches and should all return false. 1. "Alice", "allice" 2. " alice" alicee 3. "Alice", "Bob" . Here is one possible way to implement the function body 1. Use the class istringstream. istringstream is1(s1); is1 >> s1; istringstream is2(s2) is2 >> s2; 2. Technically, we have not learned about C++ classes yet. 3. However, note that string itself is a C+ + class. 4. For now, we use classes and later we shall learn how to write our own C++ classes. 5. The above code removes the leading and trailing whitespace from s1 and s2 6. Next, force all the characters in s1 and s2 to uppercase. 7. This is accomplished by using the function toupper. 8. Look up online how to use toupper, else ask your lab instructor for assistance. 9. Finally, compare s1 and s2 and return. return (s1s2)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
