//Sample Program 12- A non-interactive program to calculate student grades.
//**************************************************************************************
#include
#include
#include
#include
using namespace std;
const int SIZE=20;
int main()
{
int exam1Array[SIZE];
int exam2Array[SIZE];
int exam3Array[SIZE];
int highScore;
int count=0;
string name[SIZE];
ifstream inFile;
inFile.open("grades.dat");
if(!inFile)
{
cout<<"Unable to open input file, program abnormally ended";
return 1;
}
inFile>>name[count]>>exam1Array[count]>>exam2Array[count]>>exam3Array[count];
highScore=0;
for(count=0; count
if(array[count]>highScore)
highScore=array[count];
cout<
return 0;
}
2006-07-31
10:55:35
·
4 answers
·
asked by
Anonymous
in
Computers & Internet
➔ Programming & Design
It is supposed to read an input file containg student name, and Exam 1 score, Exam 2 score, Exam 3 score.
I'll add other fucntions later for other calculations. At this stage i just want it to read the file and find the highest in each exam and output the highest for each exam. I am having difficulty with the code and the looping. I am self-studying so it's a bit challenging at times. Please help!! THANKS!!
2006-07-31
10:57:59 ·
update #1
inFile>>name[count]>>exam1Array[count]>>exam2Array[count]>>exam3Array[count];
highScore=0;
for(count=0; count
if(array[count]>highScore)
highScore=array[count];
cout<
return 0;
2006-07-31
10:58:59 ·
update #2
inFile>>name[count]>>
exam1Array[count]>>
exam2Array[count]>>
exam3Array[count];
highScore=0;
for(count=0; count
2006-07-31
10:59:52 ·
update #3