Nested loop output problem

Im using nested loops to write a program that will calculate the average GPA for all 3 classes and then have it display. I dont quite understand the output but I understand everything else. I need help with the output...any hints or suggestions will be greatly appreciated.


#include <iostream>
#include <iomanip>

int main()
{
double StudentGpa, AvgGpa, OverallAvg;
int TotalHoursComp, StudentId;

for(classes=0; classes<3; classes++)
{
for(students=0; students<10; students++)
{
cout<<"Enter Sudent ID "<<endl;
cin>>StudentId;

cout<<"Enter Student GPA "<<endl;
cin>>SudentGPA;

cout<<"Enter Total Hours Completed "<<endl;
cin>>TotalHoursComp;

if (StudentGpa < 2.0 && TotalHoursComp < 127)
cout<<"Please visit the registrar immediately "<<endl;
else
{
cout<<"Student ID "<<StudentId<<endl;
cout<<"Total Hours Completed "<<TotalHoursComp<<endl;
}
ClassAvg += StudentGpa;

}
ClassAvg = ClassAvg/10;
cout<<"Average for class "<<classes+1<<ClassAvg<<endl;

}
P.S. Forgot this information....Calculate the GPA for each class and display the class number (1,2,3) and the average GPA after all students are processed.
Topic archived. No new replies allowed.