標題:
陣列 (二)
[打印本頁]
作者:
tonyh
時間:
2013-6-1 15:28
標題:
陣列 (二)
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{ // 0 1 2 3 4 5
int a[6]={27,28,25,29,30,29};
string b[6]={"甲","乙","丙","丁","戊","己"}; //字串陣列
for(int i=0; i<=5; i++)
{
cout<<"5年"<<b[i]<<"班: "<<a[i]<<"人"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
劉泳鱔
時間:
2013-6-1 15:29
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a[]={27,28,25,29,30,29};
cout<<a[2]<<endl;
cout<<a[0]<<endl;
cout<<a[5]<<endl;
string b[6]={"甲","乙","丙","丁","戊","己"}
for(int i=0; i<=5; i++)
{
cout<<"五年"<<b[1]<<"班: "<<a[i]<<"人"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
黃崇維
時間:
2013-6-1 15:30
本帖最後由 黃崇維 於 2013-6-1 15:33 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a[6]={1,45,65,54,85,75};
//cout<<a[5]<<endl;
//cout<<a[4]<<endl;
//cout<<a[1]<<endl;
string b[6]={"甲","乙","丙","丁","戊","己"};
for(int i=0; i<=5; i++)
{
cout<<"5年"<<(i+1)<<"班: "<<a[i]<<"人"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
鎧言
時間:
2013-6-1 15:30
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a[6]={30,34,36,26,24,26};
//cout<<a[2]<<endl;
//cout<<a[5]<<endl;
//cout<<a[0]<<endl;
string b[6]={"甲","乙","丙","丁","戊","己",};
for(int i=0, i<=5; i++)
{
cout<<"5年"<<b[i]<<"班: "<<a[i]<<"人"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
鎧言
時間:
2013-6-1 15:32
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a[6]={30,34,36,26,24,26};
//cout<<a[2]<<endl;
//cout<<a[5]<<endl;
//cout<<a[0]<<endl;
string b[6]={"甲","乙","丙","丁","戊","己"};
for(int i=0; i<=5; i++)
{
cout<<"5年"<<b[i]<<"班: "<<a[i]<<"人"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
林以諾
時間:
2013-6-1 15:35
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a[6]={17,18,15,12,11,44};
string b[6]={"甲","乙","丙","丁","庚","辛"};
//cout<<a[4]<<endl;
//cout<<a[2]<<endl;
for(int i=0;i<=5;i++)
{
cout<<"5年"<<b[i]<<"班:"<<a[i]<<"人"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
張瀚仁
時間:
2013-6-1 15:37
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a[]={25,26,27,28,29,30};
string b[6]={ "甲","乙","丙","丁","己","庚"};
for(int i=0;i<=5;i++)
{
cout<<"五年"<<b[i]<<"班:"<<a[i]<<"人"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
蘇昱安
時間:
2013-6-1 15:37
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a[6]={33,28,25,26,30,29};
string b[6]={"甲","乙","丙","丁","戊","己"};
for(int i=0; i<=5; i++)
{
cout<<"5年"<<b[i]<<"班: "<<a[i]<<"人"<<endl;
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2