Question: Write a program that calculates the average word length of a sentence. Your program should start by asking the user for a sentence. Then it

Write a program that calculates the average word length of a sentence.

Your program should start by asking the user for a sentence. Then it should calculate the average word length of the sentence. Your program should consider punctuation as part of the word to which it is attached. The output should be displayed to one decimal place.

Hints: For this program youll need a loop, inside of which there should be 2 or 3 IF/ELSE IF statements. You should also use the following functions:

getchar(): Pulls the next character from the CIN input buffer for analysis. An example can be found on tutorialspoint.com (link below).

Must use #include at the top of your program.

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!