- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- string name[5]={"王大明","李大頭","蘇小安","余美美","張醜醜"};
- int score[5][3]={{90,85,85},{70,75,80},{80,95,80},{70,95,75},{80,85,95}};
- cout<<"座號\t姓名\t\t國文\t英文\t數學\t平均"<<endl;
- cout<<"====================================================="<<endl;
- for(int i=0; i<5; i++)
- {
- float number=0;
- cout<<i+1<<"\t"<<name[i]<<"\t\t";
- for(int j=0; j<3; j++){
- cout<<score[i][j]<<"\t";
- number+=score[i][j];
- }
- cout<<number/3;
- cout<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |