Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with a problem here it is. Write a program whose main function is me

ID: 3625664 • Letter: I

Question

I need help with a problem here it is. Write a program whose main function is merely a collection of variable declarations and function calls. This program reads a text and outputs the letters, together with their counts, as explained below in the function printResult. (There can be no global variables! All information must be passed in and out of the function. Use a structure to store the information.) Your program must consist of at least the following functions:

-Function openFile: Opens the input and output files. You must pass the file streams as parameters (by refernce, of course). If the file does not exist, the program should print an appropriate message and exit. The program must ask the user for the names of the input and output files.
-Function count: counts every occurrence of capital letters A-Z and small letters a-z in the text file opened in the function openFile. this information must go into an array of structures. The array must be passes as a parameter, and the file identifier must also be passed as a parameter.
-Function printResult: Prints the numbers of capitol letters and small letters, as well as the percentage of capital letters for every letter A-Z and the percentages of small fro every letter a-z. The percentages should look like this: "25%". This information must come from an array of structures, and this array must be passed as a parameter.

Explanation / Answer

try this, it is in c++ hope that is ok. //Header File #include #include #include #include #include #include using namespace std; //Structs const int MAX_LETTERS = 26 ; struct letterCount { char letter; int count; int count_caps; }; //Function Prototypes int openFile(ifstream& infile, ofstream& outfile); void count(letterCount letters[], ifstream& infile); void printResult(letterCount letters[], ofstream& outfile); //Main Program int main() { letterCount counts[MAX_LETTERS]; ifstream infile; ofstream outfile; openFile(infile, outfile); count(counts, infile); printResult(counts, outfile); return 0 ; } //User-defined Function 1 int openFile(ifstream& inFile, ofstream& outFile) { ifstream infile; ofstream outfile; string inputFile; string outputFile; cout > inputFile; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote