I'm about 3 weeks into my C++ class. I already made a simple program below that calculates grade averages and received an A. Now my teacher wants me to turn in three variations of it, replacing the goto with a while, do while, or for loop. I have experimented and researched for hours and hours, and I am totally frustrated. Here is my program:
#include <iostream>
using namespace std;
void main()
{
int score, total, count;
float average;
total=0;
count=0;
get_next_score:
cout<<"Enter an exam score: ";
cin>>score;
if(score<0) goto calc_average;
total=total+score;
count=count+1;
goto get_next_score;
calc_average:
average=total/count;
while(score>0)cout<<"The average is "<<average;
}
Any help is greatly appreciated!!