5.3.3、二维数组案例-考试成绩统计

代码

cpp 复制代码
#include <iostream>
using namespace std;
#include <string>

int main()
{

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

	//1、创建二维数组
	int scores[3][3] =
	{
		{100,100,100},
		{90,50,100},
		{60,70,80},
	};

	string names[3] = { "张三","李四","王五" };
	//2、统计每个人的分数总和
	for (int i = 0; i < 3; i++)
	{
		int sum = 0;
		for (int j = 0; j < 3; j++)
		{
			sum += scores[i][j];
			/*cout << scores[i][j] << " ";*/
		}
		cout << names[i]<<"个人的总分为:"<<sum<< endl;
	}


	system("pause");

	return 0;
}
相关推荐
INGNIGHT9 分钟前
815 · 课程表IV(dfs)
算法·深度优先
Pniubi38 分钟前
力扣146.LRU缓存机制
算法·leetcode·缓存
云上工程笔记41 分钟前
2026年7B到67B模型训练与推理GPU配置评测:LoRA、量化与全量微调对比
人工智能·算法·机器学习
softlgh42 分钟前
鼾声识别:嵌入式离线鼾声检测 SDK 与睡眠健康数据
算法·智能家居·智能音箱·鼾声识别·智能枕头·打呼噜
了了1 小时前
图搜索基础学习笔记
算法
淡海水1 小时前
05-02-源码-Boehm GC标记阶段
算法·unity·c#·游戏引擎·gc
Code_Solitude2 小时前
传智杯备赛代码整理(前4题)
数据结构·算法
Jasmine_llq2 小时前
《P8816 [CSP-J 2022] 上升点列》
数据结构·算法·贪心·排序·二维动态规划 dp·类背包状态转移
Android小码家2 小时前
Vehicle 实战 自定义属性+测试demo
java·c++·framework·vhal·vehicle
hetao17338372 小时前
2026-10-19 hetao1733837 的刷题记录
c++·算法