Question: Create a C programming code preferably on Visual Studio 2017 (no C++ can be used). Sentence and Word Counter Write a program that reads a
Sentence and Word Counter 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 tim 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) "'(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, words on the other While a good programming practice, functions are NOT required so keep the entire program in the main 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 code. You've been warned
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
