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