c++程序—统计成绩

#include<iostream>
using namespace std;
#include<string>
#include<ctime>

int main()
{
    //成绩统计
    int scores[3][3] = 
    {
        {100,100,100},
        {90,50,100},
        {60,70,80}
    };

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

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

    
    
    system("pause");
    return 0;

}

 

posted @ 2020-02-29 23:29  Jackie_Wang  阅读(1818)  评论(0编辑  收藏  举报