如何在不包括最后一场比赛的情况下计算平均值。我不想包括最后一场比赛来结束用户需要输入-1的循环。所以,当用户输入-1这个游戏被计入平均值的时候,不应该这样结束游戏,而不是实际得分。有没有解决的办法?
while (points != -1)
{
total = total + points;
game++;
cout << "Enter the points for game " << game << ": ";
cin >> points;
average = total / game;
}
cout << "\nThe total points are " << total << endl;
cout << "\n The average points are " << average << endl;
system("PAUSE");
return 0;
}