Help with Assignment

Here is a general overview of my assignment:
In this assignment, you will write a program in C++ that uses files and nested loops to create a file from the quiz grades
entered by the user, then read the grades from the file and calculates the average quiz grade for a class. Each student
takes 4 quizzes. Use a nested loop to write each student’s quizzes to a file. Then read the data from the file in order to
display the student’s average score and the class average. Also write the program in Raptor. Input the data into the
Raptor program during runtime. Do not use files for the Raptor program.  

I have the for loop down but i'm not sure what to put in the while loop. Also I'm not sure how get the program to recognize the different sets of numbers, add them all together, and then divide by the numbers total. Any help would be appreciated.


using namespace std;
int main()
ifstream inFile;
ofstream outFile;
int studentId, quiz1=0, quiz2=0, quiz3=0, quiz4=0, choice;
int quizGradeaverage = 0;

for (int x = 0; x < 4; x++) {
cout << "Enter student ID: ";
cin >> studentId;
cout << "Enter quiz grade 1: ";
cin >> quiz1;
cout << "Enter quiz grade 2: ";
cin >> quiz2;
cout << "Enter quiz grade 3: ";
cin >> quiz3;
cout << "Enter quiz grade 4: ";
cin >> quiz4;
cout << endl;
cout << "Enter 0 for no more students. Enter 1 for more students." << endl;
cin >> choice;
if (choice == 0)
if (choice == 1)

quizGradeaverage += quiz1 + quiz2 + quiz3 + quiz4 / 1200;
cout << "The average of the student's test scores is: " << quizGradeaverage << endl;

return 0;
Topic archived. No new replies allowed.