Question: This is C++ Programming 2. Declare a string array of size 5. Prompt the user enter five strings that are stored in the array. Afterwards

This is C++ Programming

2. Declare a string array of size 5. Prompt the user enter five strings that are stored in the array. Afterwards ,prompt the user to enter a character. Write a function that expects the following three parameters: an array, the size of the array, and a char. The function counts the number of occurrences of that char in all of the strings stored in the array and returns it. Call that function from the main and output the returned value.

Dont forget to include

Use .length()on a stringvariableto get the number of characters in a string, e.g. str.length()

Use array syntax on a string variable to access any char by index, e.g.:assuminga stringvariable named strthat stores hello, str[1]would return e.

Example:

Enter five items.

Item 1: hello

Item 2: C++

Item 3: Wednesday

Item 4: Its a great day

Item 5: goodbye

Target: e

The char e was found 5 times.

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!