標題:
陣列 (八) - 成績表 2
[打印本頁]
作者:
鄭又綸
時間:
2025-5-15 19:20
標題:
陣列 (八) - 成績表 2
本帖最後由 鄭又綸 於 2025-5-15 19:41 編輯
新宣告一個一維陣列,以用來插入姓名欄位,如下圖所示。
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[5]={"王大明","李大頭","蘇小安","余美美","張醜醜"};
int score[5][3]={{43,55,77},{76,77,43},{78,11,22},{43,89,88},{98,44,67}};
cout<<"座號\t姓名\t\t國文\t英文\t數學"<<endl;
cout<<"============================================"<<endl;
for(int i=0; i<5; i++)
{
cout<<i+1<<"\t"<<name[i]<<"\t\t";
for(int j=0; j<3; j++)
cout<<score[i][j]<<"\t";
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
陳宥廷
時間:
2025-5-15 19:44
此帖僅作者可見
作者:
李岱哲
時間:
2025-5-15 19:44
此帖僅作者可見
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2