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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started