Write a C++ program, named "average.cpp", that reads the values from a data file, display the values, and computes and displays the largest, smallest, and the average of these values.
To make the data file accessible by the project, put the data file in the current project directory.
First, make sure the project has been created in CodeLite for the current programming assignment. This ensures that the project directory is created. You need to copy the data file from my account into this project directory;
Open a terminal, change directory into the project directory;
Type the following command:
cp ~cen/data/lab4*.dat . (notice there is a period at the end) This command copies the two data files (lab4-1.dat and lab4-2.dat) into your project directory.
For this program, write a single main function in your program.
21:32 Write a C++ program, named "average_pp" that reads the values from a file di values, and computes and displays the largest smallest and the average of these values the To make the data file accessible by the project, put the data file in the current project directory 1. First, make sure the project has been created in Codeline for the current i ng assignment. This ensures that the project directory is created. You need to copy the data file from my account into this project directory: 2. Open a terminal, change directory into the project directory 3. Type the following command: cp-condatalabdat. (notice there is a period at the end. This command copies the two data files (lab4-1.dat and lab4-2.0m) into your project directory. For this program, write a single main function in your program, Here is an example run of the program when the data file to be opened is specified using the statement: my Is.open(../labt-1.dat"); Sample run 1 The values read are: Total 12 numbers The largest number is 103, and the smallest number is -40. The average of these numbers is 42.9. Here is a second example run of the program when the second data file is specified in the program: statram myin my In.open(../labt-2.dat"); Sample run 2 The values read are: 240 - 390 Total 16 numbers. The largest number is 990, and the smallest number is -538. The average of these numbers is 266.9. Note: The reason we use./ab.1.dat" instead of "lab-1 dat is because we have copied the data file in the current project directory. In codelite, the executable program is stored in the directory named "Debug" in the current project directory. We need to tell the executable program that the data file is act the "Debug" directory 21:33 3. Type the following command cp-condatalab.dat (notice there is a period at the end) This command copies the two data files (lab-1.dat and lab4-2.da) into your project directory. For this program, write a single main function in your program. Here is an example run of the program when the data file to be opened is specified using the statement: itatreamin; nyin.open -labi-.dat"); Sample run 1 The values read are: Total 12 numbers. The largest number is 103, and the smallest number 1 The average of these numbers is 42.9. -40. Here is a second example nan of the program when the second data file is specified in the program itatream myin .. . myin.openx../labt-2.dat Sample run 2 The values read are: 240 -390 Total 16 numbers. The largest number is 990, and the smallest number is -538. The average of these numbers is 266.9. Note: The reason we use"./ab-1.dat" instead of "lab-1.dat" is because we have copied the data file in the current project directory. In codelite, the executable program is stored in the directory named "Debug" in the current project directory. We need to tell the executable program that the data file is actually located one directory above the "Debug directory What to Submit For this lab, you need to submit the file average.cpp handin labAverage.cpp Steps to edit, compile, run, and submit the program: Ifafter you compile your program, there is compilation erroes, then you need to modify the program according to the c i t and compile your program