Im trying to write a nested for loop that gets the data from an input file. The for loop will check the student and the 3 courses they are taking the 5 test from each course. The outer loop will be on students, the middle loop will be on courses and the inner loop will be on four tests.
Im stuck and I don't know how to write the for loop.
if (fin) {
cout << "Input not opened" << endl;
return -1;
for(int n = 1; n <= 3; n++)
{
for(int course = 1; course <= 3; course++)
{
fin >> course;
}
for(int test = 1; test <= 3; test++)
{
fin >> test1;
fin >> test2;
fin >> test3;
fin >> test4;
fin >> test5;
}
}
ofstream fout;
fout.open("Output.txt");
if (fout) {
cout << "output file not opened" << endl;
return -1;