#include <iostream>
using namespace std;
int main()
{
string name[1][3] = { "张三","李四","王五" };
int rank[3][4] = {{ 100,100,100 }, { 90,50,100 }, { 60,70,80 }};
int sum = 0;
int score [1][3];
for (int i = 0; i < 3; i++)
{
sum = 0;
for (int j = 0; j < 3; j++)
{
sum += rank[i][j];
}
score[0][i] = sum;
}
for (int m = 0; m < 3; m++)
{
cout << name[0][m] << "同学的成绩为:" << score[0][m] << endl;
}
system("pause");
return 0;
}
案例描述:有三名同学(张三,李四,王五),在一次考试中的成绩分别如下表,请分别输出三名同学的总成绩(C++)
于 2023-08-16 15:19:48 首次发布