Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create C++ file to match the output style/format of your program to that produced by the provided sample solution. Your program should work for all
Create C++ file to match the output style/format of your program to that produced by the provided sample solution. Your program should work for all provided input files. Use iostream, fstream, string, iomanip, climits only. Don't use arrays, loop & global variables!
The input files ex.)
For this project, you will write a complete C++ program that performs all of the following tasks. Use variables of Data Type float to contain all numerical values. (1) Because command line arguments are used, first action of the program is to test to make sure that 2 file names were provided. Use the test if (argc 3). If the argc value is not 3, print out an error message and what the correct format should be for running the program and terminate the program. (see page 4) (2) Using command line arguments for an input file and output file name (see command line argument slides and page 3), open the input file provided as the first command line argument. Verify that the file opened successfully. If it did not open successfully, output an error message and terminate the program. See page 4 for information on this test. (3) If the input file is successfully opened, open the output file provided as the second command line argument. Verify that the output file opened successfully. If it did not open successfully output an error message and terminate. Use the filename Bad/file" to cause the open function to fail for the output file. (4) For steps 1 and 2 output a statement stating the name of the file being opened-see the solution (5) The upper case letters A, B and C appear on the first, second and third line of the input file respectively. The input file contains a single occurrence of these letters. Immediately after each letter is a floating point number which must be read, and there may or may not be more characters after the numbers on each line (6) Read in the three numbers and then test to see if any of them are less than 0. If any are negative, determine which ones are negative, output a message as shown in the sample solution and terminate the program. (7) If all numbers are greater than or equal to 0, add them up and determine their average. From the average determine if the average is High (average75), Medium (average The program is to have error messages for the following conditions. Each of these tests results in termination of the program Two file open error message: one for the input file and one for the output file o 15 s on either side of the heading and 47 s across the botton - rest of message comes from looking at sample solution output .Error output block for when one or more numbers are negative. 15 s on either side of the heading and 47 s across the bottom. Rest of message comes from looking at the sample solution Run the sample solution to see the various error messages. See page 4 for more details.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