- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- string name[5]={"王大明","李大頭","蘇小安","余美美","張醜醜"};
- float score[5][4]={{43,55,77,0},{76,77,43,0},{78,11,22,0},{43,89,88,0},{98,44,67,0}};
- cout<<"座號\t姓名\t\t國文\t英文\t數學\t平均"<<endl;
- cout<<"======================================================="<<endl;
- for(int i=0; i<5; i++)
- {
- score[i][3]=(score[i][0]+score[i][1]+score[i][2])/3;
- cout<<i+1<<"\t"<<name[i]<<"\t\t";
- for(int j=0; j<4; j++)
- cout<<score[i][j]<<"\t";
- cout<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |