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

TOP

返回列表