REQUIREMENTSYour main function should prompt the user for to

REQUIREMENTSYour main function should prompt the user for today\'s date and the print the heading using a void function. Then your main function should open the file and read the data for a single class. As the file is read, the program should add to a total for that class and a total for each student. After the data in the file is read, the main function should call a value-returning funtion to compute the CLASS_AVG for that class.

Use this approach for each of the lines of the file, printing the lines of the report as you read that data and computing the total and average for each class. Use as few variables as possible. You can reuse some variables as you read and process the data on each line of the file. You must use the same value-returning function to compute the CLASS_AVG for each class and the STD_AVERAGE for each student. The student averages are printed on the last line of the report.

Use setw, setprecision, iomanip library fixed and showpoint to obtain the correct output.

the given numbers in the file would be

code must be done in c++

ndo system321cmd.exe What is today s date? (ex: May 1 2010 5/1/10 9/28/2010 DATE 9/28/2010 Page 1 MA COLLEGE GRADE REPORT Angela Langston Maya Malcolm Class Total Class Average 278.6 64.5 56.7 67.4 90.0 Algebra 69.7 89.4 310.3 88.6 55.3 CS1 77.0 77.6 English 86.9 91.3 67.4 347.7 89.0 100.0 361.0 Science 100.0 89-4 80.2 91.4 90.3 137.4 134-4 182.6 156.6 Average Press any key to continue

Solution

#include <iostream>
#include<ios>
#include<iomanip>
#include<fstream>

using namespace std;

float total, avg,x,marks;
int main()
{

string dt;
ifstream infile;
float marks, total, class_avg, x;

x=0; total=0;
cout<<\"What is todays\'s date?(Ex: Feb 10, 2015 = 2/10/2015): \";
cin>>dt;
cout<<\"DATE\"<<dt<<\"**********************\ ************** SMALL COLLEGE GRADE REPORT **********\ \";

infile.open(\"marks.csv\");

while(!infile.eof())
{
infile>>marks;

std::cout << std::setw(10);
std::cout << std::setprecision(5) << marks;
std::cout << std::setprecision(5) << total;
std::cout << std::setprecision(5) << class_avg;
cout<<endl;
std::cout << std::setprecision(5) << std_avg;

total=total+marks;
x++;
avg(total);
}

infile.close();

getchar();

return 0;
}

float class_avg(float total)
{
class_avg=total/x;
}

float std_avg(float total)
{
avg=(total-marks)/(x-1);
}

REQUIREMENTSYour main function should prompt the user for today\'s date and the print the heading using a void function. Then your main function should open the
REQUIREMENTSYour main function should prompt the user for today\'s date and the print the heading using a void function. Then your main function should open the

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site