Question
IN C++: In this lab, you will read in a file, count the letter frequencies in the file, and write the results to a new
IN C++: In this lab, you will read in a file, count the letter frequencies in the file, and write the results to a new file.
You can create your own input files for testing. You will begin by prompting the user for the name of the input file. Your program will read the specified file the user chooses and will continue reading from that file until the EOF (end of file) character. You will also implement a function that reads a paragraph one character at a time and counts the number or frequency of each letter in that paragraph, disregarding upper/lower cases (only 26 possible characters):
void count_letters(ifstream &, int*);
After you determine the number of letters in that paragraph of the input file, prompt the user for the name of the output file for the letter count in that particular paragraph. You will implement another function to write the number of each letter found in the paragraph:
void output_letters(ofstream &, int*);
You will put the count_letters() and output_letters() functions in one file: letters.cpp
Note that the count_letters() function only counts for one paragraph. So if there are three paragraphs in the input file, there should be three corresponding output files. In count_letters function, the int pointer input is for an array of the 26 letter counts. You must provide a count for every letter, even if it is 0. You should use arrays instead of vectors. No third party libraries are allowed.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started