Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C + + program whose main function is merely a collection of variable declarations and function calls. This program reads in text and
Write a C program whose main function is merely a collection of variable declarations and function calls. This program reads in text and outputs the letters, together with their counts. You are not allowed to use global variables. All information must be passed in and out of the functions. You will use an array to keep a count for all of the letters. Both the input file and output file must be given by the user. Your program will be broken up into functions, in four different files. Because they are in different files, you are being forced to not use global variables. One of the files is given to you maincpp
You will be given other files, that are all hpp files. Your job is to write the functions, openFiles, count, and printResults in the three different files.
InputOutput openFiles
Opens the input and output files. It will throw an error if something is wrong. There are three edge cases:
If it there are an incorrect amount of input parameters, it will throw an IncorrectParameters error.
If it fails to open the input file, throw a InvalidInputFile error
It if fails to open the output file, throw an InvalidOutputFile error
count
Counts every occurrence of capital letters AZ and small letters az in the text file opened in the function openFile.
printResult
Prints the number of capital letters and small letters, as well as the percentage of both. Don't include non letters in the count for getting the percentage
The format of each line needs to line up to the right
Few other key logistics:
The program takes in two command line arguments, input and output
Examplextxt corresponds with outputxtxt
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