I cant figure out what is wrong with this code
These are the instructions
and this is my code
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
void Get_Info(string[],int[][3]);
void Get_Average(int[][3]);
void Prt_GradeBook(string[],int[][3],int[]);
int MakeUps(int[][3]);
int Grades[5][3],average[5];
string Students[5];
int main()
{
Get_Info(Students,Grades);
Get_Average(Grades);
Prt_GradeBook(Students,Grades,average);
cout<<"There are"<<MakeUps(Grades)<<"Makeup(s) to arrange. "<<endl;
system("pause");
return 0;
}
void Get_Info(string[5],int[5][3])
{
int i, j;
ifstream infile;
infile.open("Cosc 117 Test Results.txt");
while(infile)
{
infile>>Students[i];
}
for(i=0;i<5;i++)
{
for(j=0;j<3;j++)
{
infile>>Grades[i][j];
}
}
infile.close();
}
void Get_Average(int[5][3])
{
int i,j,sum;
for(i=0;i<5;i++)
{
sum=0;
for(j=0;j<3;j++)
{
sum+=Grades[i][j];
}
average[i]=sum/3;
}
}
void Prt_GradeBook(string[5],int[5][3],int[5])
{
int i, j;
cout<<"Name"<<setw(10)<<"Test #1"<<setw(10)<<"Test #2"<<setw(10)<<"Test #3"<<endl;
for(i=0;i<5;i++)
{
j=1;
cout<<Students[i]<<setw(10)<<Grades[i][j]<<setw(10)<<Grades[i][j+1]<<setw(10)<<Grades[i][j+2]<<endl;
}
}
int MakeUps(int[5][3])
{
int count=0,i,j;
for(i=0;i<5;i++)
{
for(j=0;j<3;j++)
{
if(Grades[i][j]==0)
count++;
}
}
return count;
}
The application just stops working
like the case with infinite loops but i don't see anything wrong with it.
Please help me