Write a program called countelements declare a char array


Assignment

Language is C++. any help is appreciated, thank you!

Write a program called CountElements that does the following:

· Declare a char array called sentence of 40 elements and assign the following: (I have noted the spacing)

How(sp)is(sp)Course(sp)1,(sp)C++,(sp)going(sp)4(sp)u?

· Declare counters that will count the number of elements that are:

alphabetic, digits, upper case, lower case, punctuation and spaces

(ex: numalph=0, numdig=0, etc)

· Loop through each character in the array and increase the proper counter.

Write the lines to determine each of the outputs.

Output: alphabet letters:

digits:

etc.

(ex: while (sentence [count] != ‘\0'))

Run the program. Print the code and a screenshot.

Sample Output:

alphabet letters: 18

digits: 2

upper case: 3

lower case: 15

spaces: 7

punctuation: 5

Press any key to continue . . .

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a program called countelements declare a char array
Reference No:- TGS02779287

Expected delivery within 24 Hours