- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int num [5][4]={{1,90,80,75},
- {2,50,60,80},
- {3,10,40,89},
- {4,50,75,45},
- {5,50,75,45}};
- 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";
- cout<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |