In C++, write a method called findMatch that returns the position of a string in the array that is equal to target

All About Code
1 min readMay 2, 2022

int findMatch(const string a[], int n, string target);

Return the position of a string in the array that is equal to target; if there is more than one such string, return the smallest position number of such a matching string. Return −1 if there is no such string.

string d[9] = {
"charlie", "novembe", "alpha", "alpha", "kilo", "kilo", "kilo", "alpha", "alpha"
};
int m = findMatch(d, 9, "kilo"); // returns 4…

--

--