Question: Write a C++ program to find and correct the errors in an input file. As you can see below, the input file, input.txt consists of
Write a C++ program to find and correct the errors in an input file.
As you can see below, the input file, input.txt consists of the names, surnames, and birthdates of
the players.
In the input file, if the months entered are incorrect, you have to check this situation by using Exception Handling, and you should try to correct the month.
To correct the month, check the first 3 characters, if it matches one of the 12 months, correct it.
For example, if "Apri" is entered, its first 3 characters match "April", so correct it.
(Hint: You can use the substrO function to check the first 3 characters)
1/3
Create an output file named output.txt for all the correct or corrected inputs.
- Output File
Use composition to create two classes Date and Player.
...alization for the classes' constructors assignments
printInfo function, has to print the first name, last name, birthdate day, month, and year of the player.
2/3
In the main function,
Your program should input each line from the input file input.txt, and using Exception Handling, check the month.
> Create try-catch block for the month. You have to control the month's writing and then if it is not correct you should print the incorrectly entered month on the screen. In short, if exceptions are thrown, for the catch, try to correct the month according to the first 3 characters. If you can correct the month, output the corrected information onto the output file. In your catch block, you should create an object from the Player class.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
