Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Project_05 error message info: The output: Proiect 6 Description This program requires the utilization of concepts in Chapter 4, 5 and 6. Information regarding
C++
Project_05 error message info:
The output:
Proiect 6 Description This program requires the utilization of concepts in Chapter 4, 5 and 6. Information regarding the test scores for a class is stored in an input file. The test scores and some supporting information is read from the input file. This information is then processed and written to an output file (see the sample output shown above) Using command line arguments for an input file and output file name (see command line argument slides and page 3), print out the command line input file name (see the sample solution for the output to use) and open the input file provided. Verify that the file opened successfully (file stream is valid). i did not open successfully, enter a while loop that outputs an error message, resets the input file stream being opened and prompts the user to enter another input file name. This file name is read, echo printed and opened The loop continues until the input file is successfully opened. See project 5 for the error message information the while loop is the exact same (without the return 1;)- just replace if with while. If the input file is successfully opened, print out the command line output file name and open the output file provided. Verify that the output file opened successfully. If it did not open successfully, enter a while loop that outputs an error message, resets the output file stream being opened and prompts the user to enter another output file name. This file name is read, echo printed and opened. The loop continues until the output file is successfully opened. Use the filename "Bad/file" to cause the open function to fail for the output file The input file contains three lines. The first line is a header line containing the name of the person submitting the grades. The second line consists of 4 integer grades separated by white space. The last line is an information line that is to be used when writing to the output file. This information line is a phrase similar to "Test scores for section 01:". See the sample input files for further information When reading the data from the file, the first line is ignored (no information is required from it). Then the four scores are read and stored in integer variables. After reading the scores, the status of the input stream is tested to verify that it is still valid. If the input stream is in the fail state mode, an appropriate error message is printed to the terminal AND the output file, and the program is terminated If the input stream is valid, the scores are tested to ensure that they have positive values. If any score is less than 0, then the program prints out a message and the scores read to the terminal AND to the output file. The program is then terminated. If all scores read are greater than or equal to 0 and the input stream is still valid, the scores read are analyzed to determine their sum, average, letter grade for the average, variance and standard deviation. Formulas for performing these math functions are shown on the next page. The cmath header file may be needed for some of the math functions in the formulas. The letter grade for the average is based on the following scale for the average Average 90 80 70 60 Be sure to look at the command line argument slides For this program, instead of int main use: int main(int argc, char *argv[ ]) To run your program, type the following at the command line /Project 06 input file_name output file_name In your program, assign argv[1] to a string variable (inFileName-argv[1]:) that is to hold the input file name and argv[2] to a string variable(outFileName argv[2]) that is to hold the output file name. Use these string variables in the open function when opening the files When running the sample solution (not the comparison script), you must provide the input and output file names as command line arguments Be sure to test for the correct number of command line arguments in your program see project 5Step 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