Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 invalidStep 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