標題:
[訂正] 陣列 (九) - 成績表 3
[打印本頁]
作者:
方浩葦
時間:
2024-3-22 01:11
標題:
[訂正] 陣列 (九) - 成績表 3
新增平均欄位。
本帖隱藏的內容需要積分高於 1 才可瀏覽
作者:
謝崇亘
時間:
2024-3-23 19:37
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[5]={"王大明","李大頭","蘇小安","余美美","張醜醜"};
int score[5][3]={{43,55,77},{76,77,43},{78,11,22},{43,89,88},{98,44,67}};
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<3; j++)
cout<<score[i][j]<<"\t";
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
蘇巳權
時間:
2024-3-23 19:45
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
cout<<"\t\t\t\t"<<endl;
string name[5][6]={"王大明,李大頭,蘇小安,余美美,張醜醜"};
cout<<"=============================="<<endl;
int score[5][8]={{90,85,85},
{70,75,80},
{80,95,80},
{70,95,75},
{80,85,95};
for(int a=0;a<5;a++)
cout<<
system("pause");
return 0;
}
複製代碼
作者:
楊子毅
時間:
2024-3-23 19:46
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[5]={"王大明","李大頭","蘇小安","余美美","張醜醜"};
int score[5][3]={{43,55,77},{76,77,43},{78,11,22},{43,89,88},{98,44,67}};
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<3; j++)
{cout<<score[i][j]<<"\t";
cout<<endl;}
cout<<score[i][j]/3<<"\t";
}
system("pause");
return 0;
}
複製代碼
作者:
陳品瑞
時間:
2024-3-23 20:08
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
float sc[5][4]={{90,85,85,0},{70,75,80,0},{80,95,80,0},{70,95,75,0},{80,85,95,0}};
string n[5]={"王大明","李大頭","蘇小安","余美美","張醜醜"};
cout<<"座號\t姓名\t\t國文\t英文\t數學\t平均\n" ;
cout<<"======================================================\n";
for(int a=0;a<=4;a++)
{
cout<<a+1<<"\t"<<n[a]<<"\t\t";
sc[a][3]=(sc[a][0]+sc[a][1]+sc[a][2])/3;
for(int b=0;b<=3;b++)
{
cout<<sc[a][b]<<"\t";
}
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
陳宥澄
時間:
2024-3-23 20:13
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
float x[5][4] = {{90,85,85,0},
{70,75,80,0},
{80,95,80,0},
{70,95,75,0},
{80,85,95,0}};
string n[5] = {"王大明",
"李大頭",
"蘇小安",
"余美美",
"張醜醜"};
cout << "座號\t姓名\t\t國文\t英文\t數學\t平均\n";
cout << "====================================================\n";
for(int i=0; i<5; i++)
{
cout << i+1 << "\t" << n[i] << "\t\t";
x[i][3] = (x[i][0] + x[i][1] + x[i][2])/3;
for(int j=0; j<4; j++)
{
cout << x[i][j] << "\t";
}
cout << endl;
}
system("pause");
return 0;
}
複製代碼
作者:
楊子毅
時間:
2024-3-23 20:19
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[5]={"王大明","李大頭","蘇小安","余美美","張醜醜"};
float score[5][4]={{90,85,85},{70,75,80},{80,95,80},{70,95,75},{80,85,95}};
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;
}
複製代碼
作者:
謝崇亘
時間:
2024-3-23 20:22
#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";
for(int j=0; j<3; j++)
cout<<score[i][j]<<"\t";
cout<<(score[i][0]+score[i][1]+score[i][2])/3;
cout<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
林靖庭
時間:
2024-3-23 20:25
#include<iostream>
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},{95,80,85,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<3; j++)
cout<<score[i][j]<<"\t";
cout<<(score[i][0]+score[i][1]+score[i][2])/3;
cout<<endl;
}
system ("pause");
return 0;
}
複製代碼
作者:
蘇巳權
時間:
2024-3-23 20:34
#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++)
{
score[i][3]=(score[i][0]+score[i][1]+score[i][2])/3;
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://istak.org.tw/seed/)
Powered by Discuz! 7.2