- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- float a[5][4]={{100,100,100,0},
- {100,100,100,0},
- {100,100,100,0},
- {100,100,100,0},
- {100,100,100,0}};
- string n[5]={"王大明","李大頭","蘇小安","余美美","張醜醜"};
- cout<<"Number\tName\t\tChinese\tEnglish\tMath\tAvarage\t"<<endl;
- cout<<"-------------------------------------------------------"<<endl;
- for(int i=0; i<=4; i++)
- {
- a[i][3]=(a[i][0]+a[i][1]+a[i][2])/3;
- cout<<i+1<<"\t"<<n[i]<<"\t\t";
- for(int j=0; j<=3;j++)
- {
- cout<<a[i][j]<<"\t";
- }
- cout<<endl;
-
- }
- system ("pause");
- return 0;
- }
複製代碼 |