int _tmain(int argc, _TCHAR* argv[])
{
int i, j, a[2][4], SUM = 0, n;
double ave, m = 0;
for (i = 0; i < 2; i++)
{
cout << "请输入第:" << i + 1 << "个学生的各科成绩" << endl;
for (j = 0; j < 4; j++)
cin >> a[i][j];
}
for (i = 0; i < 2; i++)
{
int sum = 0;
cout << "第" << i + 1 << "个学生的各科成绩分别为:";
for (j = 0; j < 4; j++)
{
cout << a[i][j] << " ";
sum = sum + a[i][j];
}
ave = sum / 4.0;
if (ave > m)
{
m = ave;
n = i + 1;
}
SUM = SUM + sum;
cout << "总分为" << sum << " " << "平均成绩为" << ave << endl;
}
cout << "总成绩为" << SUM << endl;
cout << "平均成绩最高的是第" << n << "个学生" << " " << "该同学的成绩为:" << m * 4 << endl;
getchar();
return 0;
}
{
int i, j, a[2][4], SUM = 0, n;
double ave, m = 0;
for (i = 0; i < 2; i++)
{
cout << "请输入第:" << i + 1 << "个学生的各科成绩" << endl;
for (j = 0; j < 4; j++)
cin >> a[i][j];
}
for (i = 0; i < 2; i++)
{
int sum = 0;
cout << "第" << i + 1 << "个学生的各科成绩分别为:";
for (j = 0; j < 4; j++)
{
cout << a[i][j] << " ";
sum = sum + a[i][j];
}
ave = sum / 4.0;
if (ave > m)
{
m = ave;
n = i + 1;
}
SUM = SUM + sum;
cout << "总分为" << sum << " " << "平均成绩为" << ave << endl;
}
cout << "总成绩为" << SUM << endl;
cout << "平均成绩最高的是第" << n << "个学生" << " " << "该同学的成绩为:" << m * 4 << endl;
getchar();
return 0;
}