返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x;
  7.     int score[5][4]={{90,85,85},
  8.                      {70,75,80},
  9.                      {80,95,80},
  10.                      {70,95,75},
  11.                      {80,85,95}};
  12.     string name[5]={"王大明","李大頭","蘇小安","余美美","張醜醜"};
  13.     cout<<"座號\t姓名\t\t國文\t英文\t數學\t平均"<<endl;
  14.     for(int i=0; i<5; i++){
  15.         cout<<i+1<<"\t"<<name[i]<<"\t\t";
  16.         int x=0;
  17.         for(int j=0; j<3; j++){
  18.             cout<<score[i][j]<<"\t";
  19.             x+=score[i][j];
  20.         }
  21.         cout<<x/3;
  22.         cout<<endl;

  23.     }


  24.     system("pause");
  25.     return 0;
  26. }
複製代碼

TOP

返回列表