標題:
[作業] 陣列 (八) - 成績表 (三)
[打印本頁]
作者:
tonyh
時間:
2015-9-11 21:01
標題:
[作業] 陣列 (八) - 成績表 (三)
本帖最後由 tonyh 於 2015-9-11 21:33 編輯
新增平均欄位.
[attach]1383[/attach]
本帖隱藏的內容需要回復才可以瀏覽
作者:
黃璽安
時間:
2015-9-11 21:09
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[5] = {"王大明","王曉明","余美美","張醜醜","裡大頭"};
int score[5][4] = {{43,45,77,0},{76,77,43,0},{78,11,22,0},{43,89,88,0},{98,44,67,0}};
cout << "座號\t姓名\t\t國文\t英文\t數學\t平均" << endl;
cout << "====================================" << endl;
for(int i=0; i<5; i++)
{
cout<<i+1<<"\t"<<name[i]<<"\t\t";
score[i][3]=(score[i][0]+score[i][1]+score[i][2])/3;
for(int j=0; j<4; j++)
{
cout << score[i][j] << "\t";
}
cout << endl;
}
system("pause");
return 0;
}
複製代碼
作者:
林侑成
時間:
2015-9-11 21:16
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[5]={"王大明","李大頭","蘇小安","余美美","張醜醜"};
int score[5][4]={{43,55,77,0},{76,77,43,0},{78,11,22,0},{43,89,88,0},{98,44,67,0}};
cout<<"座號\t姓名\t\t國文\t英文\t數學\t平均"<<endl;
cout<<"============================================"<<endl;
for(int i=0; i<5; i++)
{
cout<<i+1<<"\t"<<name[i]<<"\t\t";
score[i][3]=(score[i][0]+score[i][1]+score[i][2])/3;
for(int j=0; j<4; j++)
cout<<score[i][j]<<"\t";
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
沈子耕
時間:
2015-9-11 21:24
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
string name[]={"王大明","王忠明","王曉明","王小小","王維曉"};
float score[5][4]={{90,85,85,0},
{100,44,95,0},
{45,65,100,0},
{92,58,100,0},
{100,100,100,0}};
cout<<"座號\t姓名\t\t國文\t英文\t數學\t平均"<<endl;
cout<<"****************************************************"<<endl;
for(int i=0; i<=4; i++){
cout<<i+1<<"\t"<<name[i]<<"\t\t";
score[i][3]=(score[i][0]+score[i][1]+score[i][2])/3;
for(int j=0; j<=3; j++)
printf("%.2f\t",score[i][j]);
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
曾挺桂
時間:
2015-9-18 19:42
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[5]={"王大明","李大頭","蘇小安","余美美","張醜醜"};
float score[5][4]={{43,55,77,0},{76,77,43,0},{78,11,22,0},{43,89,88,0},{98,44,67,0}};
cout<<"座號\t姓名\t\t國文\t英文\t數學\t平均"<<endl;
cout<<"======================================================="<<endl;
for(int i=0; i<5; i++)
{
cout<<i+1<<"\t"<<name[i]<<"\t\t";
score[i][3]=(score[i][0]+score[i][1]+score[i][2])/3;
for(int j=0; j<4; j++)
cout<<score[i][j]<<"\t";
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
王翔
時間:
2015-9-18 20:29
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[5]={"王大明","李大頭","蘇小安","余美美","張醜醜"};
int score[5][4]={{43,55,77,0},{76,77,43,0},{78,11,22,0},{43,89,88,0},{98,44,67,0}};
cout<<"座號\t姓名\t\t國文\t英文\t數學\t平均"<<endl;
cout<<"============================================"<<endl;
for(int i=0; i<5; i++)
{
cout<<i+1<<"\t"<<name[i]<<"\t\t";
score[i][3]=(score[i][0]+score[i][1]+score[i][2])/3;
for(int j=0; j<4; j++)
cout<<score[i][j]<<"\t";
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2