Write a function named "getMatchFirstLastCount" that accepts argc and argv with the same data type as command line arguments (int argc, char * args[]). It will return two integer counts: - How many arguments that contains the first and the last character are the same. - How many arguments that contains just one character For this question, you are not allowed to use string class and its method or string function such as strlen. For example, here are inputting command line arguments and their corresponding return values “” 0 and 0 “A” 1 and 1 “ONE” 0 and 0 “ONO” 1 and 0 "ONO TWT" 2 and 0 “A B C” 3 and 3 “AA BB AB” 2 and 0 Note: these C-string arguments will already be parsed and in a proper array in argv and its size in argc. Please show how this function is being called and tested. C++
Write a function named "getMatchFirstLastCount" that accepts argc
and argv with the same data type as command line arguments (int
argc, char * args[]). It will return two integer counts:
- How many arguments that contains the first and the last character
are the same.
- How many arguments that contains just one character
For this question, you are not allowed to use string class and its
method or string function such as strlen.
For example, here are inputting command line arguments and their
corresponding return values
“” 0 and 0
“A” 1 and 1
“ONE” 0 and 0
“ONO” 1 and 0
"ONO TWT" 2 and 0
“A B C” 3 and 3
“AA BB AB” 2 and 0
Note: these C-string arguments will already be parsed and in a proper
array in argv and its size in argc.
Please show how this function is being called and tested.
C++
Step by step
Solved in 4 steps with 2 images