其他分享
首页 > 其他分享> > 048.数组-二维数组案例-考试成绩统计

048.数组-二维数组案例-考试成绩统计

作者:互联网

#include <iostream>
using namespace std;
int main()
{
    //二维数组案例-考试成绩统计
    //1.创建二维数组
    int scores[3][3] =
    {
        {100,100,100},
        {90,50,100},
        {60,70,80}
    };

    string name[3] = { "张三","李四","王五" };

    for (size_t i = 0; i < 3; i++)
    {
        int sum = 0;
        for (size_t j = 0; j < 3; j++)
        {
            sum += scores[i][j];
        }
        cout << name[i] << "的总分为:" << sum << endl;
    }


    system("pause");
    return 0;
}

 

标签:考试成绩,int,scores,二维,数组,048,100,size
来源: https://www.cnblogs.com/ceovs/p/15226388.html