Question: 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

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 in that order on various lines in the input file. The letters could all be on the same line or appear on separate lines. The input file contains a single occurrence of these letters. Immediately after each letter is a floating point number which must be read (use extraction to read the numbers), 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 (average >= 75), Medium (average < 75 and average >= 25) or Low (average < 25) (8) Write the numbers read, their sum, their average and the word High, Medium or Low based on the average to the output file run the sample solution to see the formatting necessary for the output. The row of *s is 47 *s long and the phrases are in a field width of 35.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!