I do not understand how this loop repeats when the user inputs 'Y'. All of the code is in the "do" part; and the do part repeats once? After that while statement is just a return statement.
int main()
{
int score1, score2, score3; //three scores
double average; // Average score
char again; // To hold Y or N input
do
{
/Get three Scores.
cout << "Enter 3 scores and i will average them: ";
cin >> score1 >> score2 >> score 3;
//calculate and display the average
average = (score1 + score2 + score 3)/3.0;
cout << "The average is " << average << :.\n;
// Does the user want to average another set?
cout << "Do you want to average another set? (Y/N) ":
cin >> again;
} while(again == 'Y' || again == 'y');
return 0;
}
The text book explanation is too brief and not clicking in my head. Thank you for your time.