Question: Write a C++ program to accept English phrases and count the number of specific characters in the phrases. The program should be able to go

Write a C++ program to accept English phrases and count the number of specific characters in the phrases.

The program should be able to go through many input and output cycles until user hits Enter key for an empty phrase input, then the program will stop.

This function prototype must be defined:

int countLetterInString(String phrase, char c);

The main() function will call this function to get the count of character.

Input character c can be a space. The phase string can contain any character.

Sample console output:

Write a C++ program to accept English phrases and count the number

Hints:

The main() function should have a loop to read and process multiple phrases

Function countLetterInString() should have a loop to process each character in the phrase

Use the string at(x) function to get each character in a string

The getline() function can read whole line with spaces.

My code solution has 36 lines of code with many comments

his program counts number of specific characters in phrase. Enter a phrase or hit Enter key to stop: ++ is great language Enter character to count in phrase: a here are 3 a in the phrase Enter a phrase or hit Enter key to stop: It rains a lot today Enter character to count in phrase: t here are 3 t in the phrase Enter a phrase or hit Enter key to stop: De Anza College Enter character to count in phrase: e here are 3 e in the phrase Enter a phrase or hit Enter key to stop: Hello there Enter character to count in phrase: a here are 0 a in the phrase Enter a phrase or hit Enter key to stop: How are you? Enter character to count in phrase: ? here are 1? in the phrase Enter a phrase or hit Enter key to stop: Process returned 0 (0xO) execution time 118.411 s

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!