int grade, total=0;
char ans = ' ';
cout << "\n\nEnter the student's name: ";
for (int x = 1; x < 6; x++)
cout << "\nEnter grade: ";
cin >> grade;
total = total + grade;
avg = total/5;
cout << "\n\n\nName of student : " << name;
cout << "\n\nAverage : " << avg;
cout << "\n\n\n\nWould you like to enter another student's grade? (Y/N): ";
cin >> ans;
}while(ans == 'Y' || ans == 'y');
Everytime i run this program when the do while loop loops it starts from 'enter grade' instead of 'enter the students name'?
I think this is probably going to be something to do with the input stream not being flushed/cleared.
I would advise using either getline or the >>, not a mixture of both. If you have a search, there are a few posts covering this.
On another note,
avg = total/5; isn't going to do what you want. Dividing an integer by another integer isn't going to yield a double.
Thanks to both of you! <3