#include<iostream>
const int Max =5;
int main (){
using namespace std;
int golf[Max];
cout << "Please enter your golf scores .\n";
cout << "you must enter "<< Max <<"rounds .\n";
int i;
for(i= 0 ; i<Max ;i ++){
cout << "round # " <<i+1<<":\n" ;
while(! (cin>>golf[i])){
cin.clear(); //当输入不是数字时,重置输入
while(cin.get() !='\n')
continue; //去掉非法输入
cout <<"please enter a number :";
}
}
double total =0.0;
for(i=0;i<Max ;i++){
total+=golf[i];
}
cout << "总成绩为:"<<total <<"平均成绩为:"<<total/Max <<endl;
return 0;
}