Question: C language (not c++) Write a program that reads a text file as input and counts the number of sentences and words. The input to

C language (not c++)
C language (not c++) Write a program that reads a text file

Write a program that reads a text file as input and counts the number of sentences and words. The input to your program should be a user specified text file. In other words, obtain the name of the input file at run time from the user of the program. Protect your program against crashes that might be caused by a bad file name. A sentence begins with one of the following: ' 0 '...' 9 ', 'A'...' Z ', or ' a '...' z. A sentence, once started, ends with the first occurrence of one of the following sequences: 1. A TERMINATOR followed by two spaces 2. A TERMINATOR followed by one space and end-of-line 3. A TERMINATOR followed by end-of-line 4. A TERMINATOR followed by a double quote and a space 5. A TERMINATOR followed by a double quote and an end-of-line TERMINATORS: ' '(period) '?' (question mark) 'I' (exclamation point) A word begins with one of the same set of characters that begin a sentence. A word, once started, ends with the first occurrence of a space, a tab, or an end-of-line, unless the end-of-line is preceded by a hyphen. Appropriate counting actions should be taken when the end-of-file (EOF) is encountered. The output total number of sentences and words should be printed to the screen. TIPS: Make two passes through the input file. Count the sentences on one pass, wards on the other. While a good programming practice, functions are NOT required so keep the entire program in the moin function. implement the word counter first because it is, arguably, the easier than the sentence counter. MOST IMPORTANTLY, focus on your algorithm before you implement it with cade. You've been warned

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!