Home » questions » C++ update....?
C++ update....?
I finally figured that sub-code out(with some hints from others)..For those who do not know, this is a simple way to read an input file containing scores for 3 exams(in this case, of 6 students), and output the highest in each exam...
//Sample Program 12- A non-interactive program to calculate student grades.
//**************************************************************************************
#include
#include
#include
#include
using namespace std;
const int SIZE=6;
int GetHighValue(int array[]);
int main()
{
int exam1Array[SIZE];
int exam2Array[SIZE];
int exam3Array[SIZE];
int i=0;
string name;
ifstream inFile;
inFile.open("grades.dat");
if(!inFile)
{
cout<<"Unable to open input file, program abnormally ended";
return 1;
}
for(i=0; i>name>>exam1Array[i]>>exam2Array[i]>>exam3Array[i];
}
GetHighValue(exam1Array);
cout<<"The highest for exam 1 is"<highScore)
highScore=array[i];
}
return highScore;
}

Answers
adnanan34
On 2006-08-01 21:12:44
swami060
On 2006-08-01 21:15:12