返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     float a[5][4]={{90,85,85,(90.0+85.0+85.0)/3},
  7.                    {76,77,43,(76.0+77.0+43.0)/3},
  8.                    {78,11,22,(78.0+11.0+22.0)/3},
  9.                    {43,89,88,(43.0+89.0+88.0)/3},
  10.                    {98,44,67,(98.0+44.0+67.0)/3}};
  11.     string b[5]={"Adam","John","Mary","Sharon","Willion"};
  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";
  17.         cout<<b[i]<<"\t\t";
  18.         for(int j=0; j<4; j++)
  19.         {
  20.             cout<<a[i][j]<<"\t";
  21.         }
  22.         cout<<endl;
  23.     }
  24.     system("pause");
  25.     return 0;
  26. }
複製代碼

TOP

返回列表