返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main(){
  5.     string name[]={"王大明","王忠明","王曉明","王小小","王維曉"};
  6.     float score[5][4]={{90,85,85,0},
  7.                      {100,44,95,0},
  8.                      {45,65,100,0},
  9.                      {92,58,100,0},
  10.                      {100,100,100,0}};
  11.     cout<<"座號\t姓名\t\t國文\t英文\t數學\t平均"<<endl;
  12.     cout<<"****************************************************"<<endl;
  13.     for(int i=0; i<=4; i++){
  14.        cout<<i+1<<"\t"<<name[i]<<"\t\t";
  15.        score[i][3]=(score[i][0]+score[i][1]+score[i][2])/3;
  16.        for(int j=0; j<=3; j++)      
  17.           printf("%.2f\t",score[i][j]);
  18.        cout<<endl;     
  19.     }
  20.     system("pause");   
  21.     return 0;
  22. }
複製代碼
ABCDEFGHIJKLMNOPQRSTUVWXYZ

TOP

返回列表