私は射手の得点を求めるネストループコードを作成する必要があります。四つの射手と三つの射手があるので、射手は射手のために別の3つの値。問題は、アーチェルの得点を求め続けているだけで、次のラウンドには行かず、現在のラウンドを終了させず、そのラウンドの平均得点を表示しないということです。C++代入アシスタンス
#include <iostream>
using namespace std;
int main()
{
//DECLARATIONS
int score;
int round;
int total;
double average = 0; // average score of an archer
for (round = 0; round < 4;) {
cout << "Please enter the Archer's Score' ";
cin >> score;
if (score<0, score> 60) {
cout << "\nThe value you entered is out of range, Please enter a number between 0 - 60 \n";
}
total = total + score;
}
cout << "Total Score = " << total << endl;
average = total/round;
cout << "Average Score = " << average << endl;
return 0;
}
'if(スコア<0, score> 60){'はあなたの望むことをしません。 – drescherjm
合計は初期化されていません。たぶん、あなたは増加ラウンドする必要があります。 – drescherjm
あなたは 'round'をインクリメントしません。 ** – Beta