EDITH GINGRAS wrote:
string student [max_students];
int students [max_students][max_grade] = {0,0};
Warning: the variable 'students' has really a silly name ('grades' would be better, IMHO).
EDITH GINGRAS wrote:
for (int curstudent =0; curstudent < numstudent; curstudent++){
cout << "Enter the students name: ";
cin >> student[curstudent];
for (int curgrade =0; curgrade < numgrade; curgrade++){
cout << "Enter the grade: ";
cin >> student[curgrade];
}
}
Wrong, change to
for (int curstudent=0; curstudent < numstudent; curstudent++)
{
cout << "Enter the students name: ";
cin >> student[curstudent];
for (int curgrade=0; curgrade < numgrade; curgrade++)
{
cout << "Enter the grade: ";
cin >> students[curstudent][curgrade];
}
}
EDITH GINGRAS wrote
:student [0] = 100;
student [1] = 75;
student [2] = 50;
student [3] = 25;
Wrong: remove such bogus lines.
EDITH GINGRAS wrote:
for (int curstudent =0; curstudent < numstudent; curstudent++){
for (int curgrade =0; curgrade < numgrade; curgrade++){
cout << student [0] << endl;
cout << student [1] << endl;
cout << student [2] << endl;
cout << student [3] << endl;
}
}
Wrong: change to
for (int curstudent=0; curstudent < numstudent; curstudent++)
{
cout << student [curstudent] << endl;
for (int curgrade=0; curgrade < numgrade; curgrade++)
{
cout << students[curstudent][curgrade] << endl;
}
}
BTW why are you using fixed-size arrays, instead of, for instance, the
std::vector
class?
:)