Question: CODE in C++: Write a function that compares two strings of equal length in one of two ways. Both comparison methods compare the characters of
CODE in C++:

Write a function that compares two strings of equal length in one of two ways. Both comparison methods compare the characters of one string to the characters of the other string in the location (e.g., the first letter of the first string to the first letter of the second string, et cetera). The two comparison methods are: "same": Calculates and returns a percentage of how similar two strings are "diff": Calculates and returns a percentage of how dissimilar two strings are If the function is called without either of those strings as the comparison method, your function should return 0. Use the following function header: double stringComparator(string stringOne, string stringTwo, string comparisonType) For example: Calling your function and using the values ("Computer", "confuser", "diff"), you would return 5 because 4 out of 8 letters are different. Calling your function and using the values ("pickle", "sticks", "same") would return 0 since no letters are the same. Calling your function and using the values ("computer", "computer", "difference") would return 0 since the comparison Type value is invalid
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
