/Word-Count

Word/sentence count

Primary LanguageShell

Word-Count

Objective: use if statements, loops, formatting output, and strings

Write a C++ program that counts the number of words and sentences in some text. The text will be terminated by the three symbols “@@@”. A word is defined as a string terminated by a white space. A sentence will be terminated by a period, exclamation mark, or a question mark.

Your program must output the number of words, sentences, and the average number of words per sentence rounded to one decimal place. Your program must print an error message for the average if the user enters no words or no sentences (words without a period, exclamation mark, or question mark).