issue with nested loop

I'm having trouble with calculating grades using nested loops.

my professor wants this.
_____________________________________________________________________________
Two example files - “student1.txt” and “student2.txt” are given on BlackBoard along with this question. Each line represents a student. The first column is the student ID; the remaining columns are the scores. -1 represents an excused score.

Input: the input user should enter the name of the file and the number of exams for the given semester Output: Below is a sample I/O. Only the bolded numbers are the inputs provided by the user.

Enter the name of the file that has the scores of students: student1.txt Enter the number of scores for each student: 4

Let’s say if the input file of student scores looks like this:
15 51 55 50 52
25 80 -1 70 -1
23 53 -1 57 40
21 50 -1 49 50

The output file should look like this
ID=15 Avg=52 Grade=S
ID=25 Excused=2 Grade=I
ID=23 Avg=50.0 Grade=S
ID=21 Avg=49.7 Grade=U

Number of Grades of Type
SUI
211
____________________________________________________________________________

student1txt.
15 51 55 50 52
25 80 -1 70 -1
23 53 -1 57 40
21 50 -1 49 50
____________________________________________________________________________
student2txt.
15 51 55 50 52
25 80 -1 70 -1
23 53 -1 57 40
21 50 -1 49 50
234 60 78 65 20
211 -1 -1 -1 -1
45 0 0 0 0
29 -1 45 56 50
_____________________________________________________________________________

if anyone can help me it would be greatly appreciate, I'm having a tough time.
What have you written so far?

What, specifically, are you having problems with?
I'm having trouble with the input and output of the files.

I know I have to ifstream inputfile and string it. What I am having a problem with is actually putting the information into the file.

I understand the -1 and how to cout everything, I am just not understanding how to put the information into the file so it can be brought up once the user inputs the txt file and the number of scores.
Topic archived. No new replies allowed.