返回列表 發帖

[9/16作業1] 陣列 (九) - 成績表 3

本帖最後由 李泳霖 於 2023-10-7 14:16 編輯

新增平均欄位。

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int score[5][3]={{90,85,85},{70,75,80},{80,95,80},{70,95,75},{80,85,95}};
  7.     string b[5]={"王大明","李大頭","蘇小安","余美美","張醜醜"};
  8.     cout<<"座號\t姓名\t\t國文\t英文\t數學"<<endl;
  9.     cout<<"========================================="<<endl;
  10.     for(int i=0; i<5; i++)
  11.     {
  12.         cout<<i+1<<"\t";
  13.         cout<<b[i]<<"\t"<<"\t";
  14.         for(int j=0; j<3; j++)
  15.              cout<<score[i][j]<<"\t";
  16.         cout<<endl;
  17.     }
  18.     system("pause");
  19.     return 0;
  20. }
複製代碼
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊
istak.teach2@gmail.com

此帖僅作者可見
istak.teach2@gmail.com

TOP

返回列表