Impedance the following function given this function prototype: int maxASCIIStri
ID: 3684246 • Letter: I
Question
Impedance the following function given this function prototype: int maxASCIIStringPosition(vector input_strings); where input_strings is a vector of strings to be processed. If the vector is empty. The maxASCIIStringPosition function should return the index of the vector containing the string with the largest sum ASCII values. For example maxASCIIStringPosition(["abc", "bcd", "aaa"]) should return 1 because the sum of 'b', 'c', 'd' is greater than the other two strings. Assume ["abc"....] is a vector in this example.Explanation / Answer
Answer:
int maxASCIIStringPosition(vector<string> input_strings)
{
int len=0;
if(input_strings=="")
return -1;
else
len = strlen(input_strings);
for (i = 0; i < len; i++)
{
sum = sum + input_strings[i];
}
return sum;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.