Page 1 of 1

Answer only with #include and using namespace std; Write a program whose input is a character and a string, a

Posted: Fri Apr 29, 2022 6:51 am
by answerhappygod
Answer only with #include <iostream> and using namespace
std;
Write a program whose input is a character and a string, and
whose output indicates the number of times the character appears in
the string. The output should include the input character and use
the plural form, n's, if the number of times the characters appears
is not exactly 1.
Ex: If the input is:
the output is:
Ex: If the input is:
the output is:
Ex: If the input is:
the output is:
Case matters. n is different than N.
Ex: If the input is:
the output is:
The program must define and call the following function that
takes the input string and character as parameters, and returns the
number of times the input character appears in the input
string.
int CalcNumCharacters(string userString, char userChar)