標題:
陣列 (六) - 成績表 1
[打印本頁]
作者:
tonyh
時間:
2019-12-6 19:21
標題:
陣列 (六) - 成績表 1
利用二維陣列,試做一個包含五位同學,各三組分數的成績表格。
表格的形式如下:
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score[5][3]={{90,85,85},
{70,75,80},
{80,95,80},
{70,95,75},
{80,85,95}};
cout<<"座號\t國文\t英文\t數學"<<endl;
cout<<"============================"<<endl;
for(int i=0; i<5; i++)
{
cout<<i+1<<"\t";
for(int j=0; j<3; j++)
cout<<score[i][j]<<"\t";
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
孫嘉駿
時間:
2019-12-6 19:36
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x[5][3]={{90,85,85},{70,75,80},{80,95,80},{70,95,75},{80,85,95}};
cout<<"座號\t國文\t英文\t數學"<<endl;
cout<<"============================"<<endl;
for(int f=0; f<5; f++)
{
cout<<f+1<<"\t";
for(int j=0; j<3; j++)
cout<<x[f][j]<<"\t";
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
黃辰昊
時間:
2019-12-6 19:37
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score[5][3]={{90,85,85},
{70,75,80},
{80,95,80},
{70,95,75},
{80,85,95}};
cout<<"座號\t國文\t英文\t數學"<<endl;
cout<<"============================"<<endl;
for(int i=0; i<5; i++)
{
cout<<i+1<<"\t";
for(int j=0; j<3; j++)
cout<<score[i][j]<<"\t";
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
林政瑜
時間:
2019-12-6 19:37
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int s[5][3]={{90,85,85},
{70,75,80},
{80,95,80},
{70,95,75},
{80,85,95}};
cout<<"座號\t國文\t英文\t數學"<<endl;
cout<<"============================"<<endl;
for(int i=0; i<5; i++)
{
cout<<i+1<<"\t";
for(int j=0; j<3; j++)
cout<<s[i][j]<<"\t";
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
李宇澤
時間:
2019-12-6 19:38
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score[5][3]={{90,85,85},
{70,75,80},
{80,95,80},
{70,95,75},
{80,85,95}};
cout<<"座號\t國文\t英文\t數學"<<endl;
cout<<"==============================="<<endl;
for(int a=0; a<5; a++)
{
cout<<a+1<<"\t";
for(int b=0; b<3; b++)
cout<<score[a][b]<<"\t";
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
余有晉
時間:
2019-12-6 19:38
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score[5][3]={{100,95,90},
{99,94,91},
{98,95,98},
{97,95,93},
{96,97,95}};
cout<<"座號\t國文\t英文\t數學"<<endl;
cout<<"============================"<<endl;
for(int i=0; i<5; i++)
{
cout<<i+1<<"\t";
for(int j=0; j<3; j++)
cout<<score[i][j]<<"\t";
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
陳宥穎
時間:
2019-12-6 19:41
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int h[5][3]={{90,85,85},{70,75,80},{80,95,80},{70,95,75},{80,85,95}};
cout<<"座號\t國文\t英文\t數學"<<endl;
cout<<"============================"<<endl;
for(int i=0; i<5; i++)
{
cout<<i+1<<"\t";
for(int u=0; u<3; u++)
{
cout<<h[i][u]<<"\t";
}
cout<<"\n";
}
system("pause");
return 0;
}
複製代碼
作者:
黃宥華
時間:
2019-12-6 19:42
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int n[5][3]={{90,85,85},
{70,75,80},
{80,95,80},
{70,95,75},
{80,85,95}};
cout<<"座號\t國語\t英文\t數學\t"<<endl;
cout<<"==========================="<<endl;
for(int i=0; i<5; i++)
{
cout<<i+1<<"\t";
for(int j=0; j<3; j++)
{
cout<<n[i][j]<<"\t";
}
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
蔡忻霓
時間:
2019-12-6 19:46
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score[5][3]={{90,85,85},
{70,75,80},
{80,95,80},
{70,95,75},
{80,85,95}};
cout<<"座號\t國文\t英文\t數學"<<endl;
cout<<"============================"<<endl;
for(int i=0; i<5; i++)
{
cout<<i+1<<"\t";
for(int j=0; j<3; j++)
cout<<score[i][j]<<"\t";
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
董宸佑
時間:
2019-12-6 19:49
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int s[5][3]={{90,85,85},{70,75,80},{80,95,80},{70,95,75},{80,85,95}};
cout<<"座號\t國文\t英文\t數學"<<endl;
cout<<"============================"<<endl;
for(int i=0; i<5; i++)
{
cout<<i+1<<"\t";
for(int j=0; j<3; j++)
cout<<s[i][j]<<"\t";
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
蔡忻霓
時間:
2019-12-13 19:47
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[5]{"王大明","李大頭","蘇小安","余美美","張醜醜"};
float score[5][4]={{90,85,85,0},
{70,75,80,0},
{80,95,80,0},
{70,95,75,0},
{80,85,95,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";
for(int j=0; j<4; j++)
{
cout<<score[i][j]<<"\t";
}
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2