返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      int score[5][3]={{90,85,85},
  7.                      {70,75,80},
  8.                      {80,95,80},
  9.                      {70,95,75},
  10.                      {80,85,95}};
  11.    
  12.     cout<<"座號\t國文\t英文\t數學"<<endl;
  13.     cout<<"============================"<<endl;
  14.     for(int i=0; i<5; i++)
  15.     {
  16.         cout<<i+1<<"\t";
  17.         for(int j=0; j<3; j++)
  18.              cout<<score[i][j]<<"\t";
  19.         cout<<endl;
  20.     }
  21.     system("pause");
  22.     return 0;
  23. }
複製代碼

TOP

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

TOP

返回列表