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