Hi, could anybody please tell me what i am doing wrong in this program.
The goal is to read the student name and grade from a text file and print it on the screen.
This is what i have so far. by the way this is for a school project that is due this coming Monday. The attached file is the input source.
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
//void calculateAverage();
//int calculateGrade();
//void updateFrequency();
int main()
{
const int size=10;
int debug=size;
int test1[size], test2[size], test3[size], test4[size], test5[size];
ifstream infile;
for(int i=0;i<size;i++)
{
test1[i]=0;
test2[i]=0;
test3[i]=0;
test4[i]=0;
test5[i]=0;
}
cout<<"Reading from file ''input.txt''..."<<endl;
infile.open("input.txt");
while(size==debug)
{
for(int i=0;i<size;i++)
{
infile>>test1[i];
infile>>test2[i];
infile>>test3[i];
infile>>test4[i];
infile>>test5[i];
}
debug--;
}
for(int i=0;i<size;i++)
{
cout<<test1[i]<<" "<<test2[i]<<" "<<test3[i]<<" "<<test4[i]<<" "<<test5[i]<<" "<<endl;
}
infile.close();
system("pause");
return 0;
}