Когда я запускаю программу, она в среднем усредняется, но не зацикливается! Кто-нибудь видит, что я делаю неправильно, и указывает мне правильное направление
#include <iostream>
#include <iomanip> using namespace std;
//function prototypes
void getTestScores(double &score1, double &score2, double &score3);
double calcAverage(double &score1, double &score2, double &score3);
void displayAverage(double avg);
int main()
{
//declare variables
double score1 = 0.0;
double score2 =0.0;
double score3 = 0.0;
double avg = 0.0;
//display average in fixed-point notation
getTestScores(score1,score2,score3);
calcAverage(avg);
displayAverage(avg);
//enter scores
while (avg != -1 );
{
cout << "score 1 (negative number to stop): ";
cin >> score1;
cout << "Enter score 2(negative number to stop): ";
cin >> score2;
cout << "Enter score 3(negative number to stop): ";
cin >> score3;
calcAverage(score1, score2, score3);
displayAverage(avg);
return 0;
}
} //end of main function
//*****function prototypes*****
void getTestScores(double &score1, double &score2, double &score3)
{
cout << "Enter score 1(negative numberto stop): ";
cin >> score1;
cout << "Enter score 2(negative number to stop): ";
cin >> score2;
cout << "Enter score 3(negative number to stop): ";
cin >> score3;
} //end
double calcAverage (double &score1, double &score2, double &score3)
{
double average = 0.0;
average = calcAverage(score1, score2, score3);
return average;
} //end of clacAverage
void displayAverage(double avg)
{
cout << fixed << setprecision(1);
cout << "Average: " << avg << endl;
} //end