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