/* ************ 二维数组 ************ */
#include <iostream>
using namespace std;
int main()
{
string stu_name[] = {"药水哥", "周淑怡", "格瓦拉"};
string course_name[] = {"语文", "数学", "英语"};
const int row = sizeof(stu_name) / sizeof(stu_name[0]);//
const int col = sizeof(course_name) / sizeof(course_name[0]);//
int score[row][col];//定义分数
for (int i = 0; i < row; i++)//外层循环控制学生
{
for (int j = 0; j < col; j++)//内层循环控制课程
{
cout << stu_name[i] << "的" << course_name[j] << "成绩是:";
cin >> score[i][j];
}
}
/* ********** 打印课程 *********** */
cout << endl;//换行
cout << "\t";
for (int j = 0; j < col; j++)//循环控制课程
{
cout << course_name[j] << "\t";//打印课程
利用C++,输入学生姓名,课程成绩,打印相对应的课程表
最新推荐文章于 2023-04-01 20:05:24 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)