Question: C++: Write a program that reads a string and outputs the number of times each lower case letter appears in it. The program should process
C++: Write a program that reads a string and outputs the number of times each lower case letter appears in it.
The program should process only characters in the string itself, in other words you do not need the whole alphabet here.
Functions needed:
string getString() - this function returns the string to the calling function that will be analyzed. The string is entered by the user.
int countChar(char, string ) - this function takes a character and a string and returns the number of times the character is found in the string
The input to test the program is:
This is a really LONG string to test your program
The output should be:
Enter your string for analysis: This is a really LONG string to test your program
String Analysis
h: 1
i: 3
s: 4
i: 3
s: 4
a: 3
r: 5
e: 2
a: 3
l: 2
l: 2
y: 2
s: 4
t: 4
r: 5
i: 3
n: 1
g: 2
t: 4
o: 3
t: 4
e: 2
s: 4
t: 4
y: 2
o: 3
u: 1
r: 5
p: 1
r: 5
o: 3
g: 2
r: 5
a: 3
m: 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
