- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
-
- int num [5][4]=
- {
- {1,77,52,77},
- {2,50,95,99},
- {3,56,91,65},
- {4,45,55,69},
- {5,88,59,99}
- };
- cout<<"座號\t國文\t英文\t數學\t總分\t平均"<<endl;
- cout<<"============================================"<<endl;
-
- for(int i=0; i<5;i++)
- {
- int total=0;
- for(int j=0; j<4;j++)
- {
- cout<<num[i][j]<<"\t";
- if(j!=0)
- {
- total += num[i][j];
- }
-
- }
- cout<<total<<"\t";
- cout<<total/3<<"\t"<<endl;
- cout<<endl;
- }
-
- system("pause");
- return 0;
- }
複製代碼 |