Question: In C++ please Write a program that numbers the lines found in a text file and keeps tracks of the character statistics of the file.
Write a program that numbers the lines found in a text file and keeps tracks of the character statistics of the file. The program should read text from the file and output each line to the screen, preceded by a line number. Also keep track of the number of paragraphs, the total line count, the total word count, the total character count, the alpha character count, the non-alpha character count, and the white space count. The sum of the alpha, non-alpha, and white space characters should be equal to the total character count in the file. Use the bob.txt"as the input file once again The function prototype for your computations should be: void fileParser (ifstreamsEile) The function should perform all necessary computations and print the results to the screen. Print the line number at the start of the line, right justified in a field of three spaces. Follow the line number with a colon, a single space, and the line of text The only purpose of the main function is to open the file, exit the program if the file fails to open, call the fileParser function, and close the file. As an example, if you execute the program with the following underlined inputs, the output will be: main.o 1: Bob 3: I, man, am regal-a German an I : Never odd or even 5: If I had a hi-f 6: Madam, I'm Adam 7: Too hot to hot 8: No lemons, no melon 9: Too bad I hid a boot 10: lisa Bonet ate no basi1 42: God! A red nugget! A fat egg under a dog! 43: Go hang a salami, I' a lasagna hog Paragraph Count: Line Count: Word Count: Character Count: 43 189 850 Alpha Character Count: 606 Non-Alpha Char Count:49 White Space Count: 195
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
