//5.2一题不会,想紫砂了
//注意:学号(id)输入用cin.getline,并标出结束的标志是空格即可
AC代码:
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
char id[15];
cin.getline(id, 15, ' ');//注意输入格式
//测试:
double score = 0;
double sum = 0;
double ave = 0;
for (int i = 1; i <= 8; i++)
{
cin >> score;
sum += score;
}
ave = sum / 8.0;
for (int i = 0; id[i] != '\0'; i++)
{
cout << id[i];
}
cout<<":" << setw(7) << setfill(' ') << fixed << setprecision(3) << ave;
//system("pause");//注意输出格式
return 0;
}