I have a program for my C++ class and I have no idea what to do or get started cause we did not learn it in class. This is the program:
For this assignment, you will write a program that reads characters from a file that you have opened for input. It will count several categories of characters (vowels, digits, etc. etc.) and present summary totals after it has read the input file.
Input
You can create and use your own small text file for testing. The file that we will use for grading purposes is named hopper.txt When you submit your program, make sure that is the name of the file that your program opens.
Processing Requirements
For this assignment, you will need to explicitly open a file for input. Declare an ifstream variable as described in class, and open it using the filename "hopper.txt". If the file fails to open, print an error message and exit the program.
As discussed in class, you can use the following skeleton code to read and process every character in a file:
inFile.get(ch);
while (inFile)
{
cout << ch; // This will display the char on screen
// Process the char by incrementing one or more counts
// Read the next char
inFile.get(ch);
}
For each character read, your program will increment one or more of five counters using function calls to determine whether to increment each one or not:
always increment one counter for each and every character
increment a "vowel counter" if it is a vowel (include 'a', 'e', 'i', 'o', and 'u'; upper or lower case. See isVowel() below)
increment a "consonant counter" if it is a consonant (any letter that is not a vowel. See isConsonant() below)
increment a "letter counter" if it's a letter (use the library function isalpha())
increment a "digit counter" if it's a digit (use the library function isdigit())
After doing these checks, perform four other checks in a switch statement:
if the character is a '(' increment a left parenthesis counter
if the character is a ')' increment a right parenthesis counter
if the character is a single quote, increment a single quote counter
if the character is a double quote, increment a double quote counter
In addition, as shown above, as the program reads each character, it will write it to the screen using cout This way you will see what is in the file.
Functions
Both of these functions simply test a character to see if it is or is not of a certain type.
bool isVowel(char ch) - this function tests its argument to see if it is a vowel. 'a', 'e', 'i', 'o', and 'u' (and their uppercase versions) are considered vowels for the purposes of this program. You can simplify the test by using the library character function toupper(). Return true if ch is a vowel and false if not.
bool isConsonant(char ch) - this function tests its argument to see if it is a consonant. A consonant is any letter that is not a vowel. You can use isVowel() and the library function isalpha() to simplify this. Return true or false accordingly.
Output
After you have processed all of the input and accumulated all of the counts, you should close the input file and then display a nicely formatted and labeled summary of the counts with some possible "warning" messages:
total character count
vowel count
consonant count
letter count
a warning message if the vowel count plus the consonant count is not equal to the letter count
digit count
left parenthesis count
right parenthesis count
a warning message if the left and right parenthesis counts do not match
the single quote count
the double quote count
a warning message if the double quote count is not an even number
an "other count" equal to the difference between the total character count and the sum of the letter, digit, left-paren, right-paren, single-quote, and double-quote counts.
This is the hopper.txt:
https://webcourses.niu.edu/bbcswebdav/pid-3911041-dt-content-rid-24199180_2/xid-24199180_2
The output is the same as the hopper except this is at the end of it:
Summary
Total characters: 8282
Vowels: 2418
Consonants: 3970
Letters: 6388
Digits: 174
Left parentheses: 17
Right parentheses: 17
Single quotes: 17
Double quotes: 14
Other: 1655
Any and all help would be amazing! Thank you in advance.