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