Answered step by step
Verified Expert Solution
Link Copied!
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 4 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 (main.cpp).
You will be given 3 other files, that are all .hpp files. Your job is to write the 3 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 A-Z and small letters a-z 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
Example[x].txt corresponds with output[x].txt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students explore these related Databases questions