Here is what I have to write for my stupid "C Programming" class in college. Ugh. If anyone can help, it would be much appreciated.
Write a C program that reads a sentence (i.e. unknown number of characters
ending with a period '.') and prints each word in the sentence on a separate line.
The program should also print the length of each word. At the end, it will print the
number of characters in the longest word. The sentence must start with a non -blank
character and each word must be separated with exactly one blank character. (For
this program a word is a sequence of any non-blank characters). There shouldn’t be
any spaces between the last word and the period that ends the sentence. Your
program should read the sentence one character at a time.
Sample Run 1:
Type the sentence: What a lovely day.
What 5 characters.
a 1 character.
lovely 6 characters.
day 3 characters.
The longest word in the sentence is 6 characters long.
(Put a tab character between the words and the count of characters in the output)
Your program must include a function that reads a single word, prints the word
and the number of characters, and returns the number of characters. Use the
following function header:
(Hint: The function should continue reading and printing characters one by one
until it re ads a blank (‘ ‘) or a period (‘.’). Then it should print and return the count
to the main function. You must think of a way of how to inform the main function
when the last word is read and printed)
Your main function should call the function read_and_count() properly so that it
can use the value that the function returns to find the number of characters in the