- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int num [5][4]={{1,50,51,52},{2,53,54,55},{3,56,57,58},{4,59,60,61},{5,62,63,64}};
- cout<<"座號\t國語\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";
- cout<<endl;
- }
-
-
- system("pause");
- return 0;
- }
複製代碼 |