Answered step by step
Verified Expert Solution
Link Copied!

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++:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

Students also viewed these Databases questions