#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
/**
function to compute average of array scores
*/
int average(int scores[], int len)
{
int total=0;
for(int i=0; i<len; i++)
total+=scores[i];
return total/len;
}
/**
function to open the file to read scores
*/
bool open_filename(string filename, ifstream &stream)
{
stream.open(filename.c_str());
if(stream.is_open()) return true;
else return false;
}
/**
function to print scores and other things
*/
void print_scores(int scores[], int len, int avg)
{
char c;
cout<<“Score Report for Fall’18″<<endl;
cout<<left<<setw(10)<<“Id”<<setw(10)<<“Score”<<setw(10)<<“Grade”<<endl;
for(int i=0; i<len; i++)
{
if(scores[i]>=avg+10) c = ‘E’;
else if(scores[i]>=avg-10) c=’S’;
else c=’U’;
cout<<left<<setw(10)<<i<<setw(10)<<scores[i]<<setw(10)<<c<<endl;
}
}
/**
main function
*/
int main()
{
ifstream ifile;
string filename=”score.txt”;
int len=0; // number of students
int scores[25];
if(open_file(filename, ifile))
{
while(!ifile.eof())
ifile>>scores[len++];
len–; // reduce one for eof or end of file character
int avg = average(scores, len);
print_scores(scores, len, avg);
ifile.close();
}
return 0;
}
there is a error in line 52 col 30
that 52 30 C:UsersseokbOneDriveDesktoplab 4.cpp [Error]’open_file’ was