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

TOP

返回列表