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

TOP

返回列表