標題:
陣列 (二)
[打印本頁]
作者:
陳品肇
時間:
2019-7-20 10:07
標題:
陣列 (二)
本帖最後由 陳品肇 於 2019-7-20 11:16 編輯
[attach]6847[/attach]
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
//0 1 2 3
int a[]= {30, 31, 0, 32, 31, 35, 28 ,29}; //一個陣列 一維陣列
string c[]= {"忠","孝","仁","愛","信","義","和","平"};
for(int i=0;i<8;i++)
{
cout<<"5年"<<c[i]<<"班有"<<a[i]<<"人"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
王建葦
時間:
2019-7-20 11:06
本帖最後由 王建葦 於 2019-7-20 11:19 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x[8]={30,31,33,32,31,35,28,29};
string y[8]={"忠","孝","仁","愛","信","義","和","平"};
for(int i=0;i<8;i++)
{
i+1;
cout<<"5年"<<y[i]<<"班有"<<x[i]<<"人"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
黃傳耀
時間:
2019-7-20 11:06
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int people[] = {30,31,33,32,31,35,28,29};
string classroom[] = {"忠","孝","仁","愛","信","義","和","平"};
for(int i = 0;i<=7;i+=1)
{
cout<<"5年"<<classroom[i]<<"班有"<<people[i]<<"人"<<endl;;
}
system("pause");
return 0;
}
複製代碼
作者:
陳宇柏
時間:
2019-7-20 11:07
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a[]={30,31,33,32,31,35,28,29};
string c[]={"忠","孝","仁","愛","信","義","和","平"};
for(int i=0; i<8; i++)
{
cout<<"5年"<<c[i]<<"班有"<<a[i]<<"人"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
邱楷宸
時間:
2019-7-20 11:08
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x[8]={30,31,33,32,31,35,28,29};
string y[8]={"忠","孝","仁","愛","信","義","和","平"};
for(int i=0;i<8;i++)
{
i+1;
cout<<"5年"<<y[i]<<"班有"<<x[i]<<"人"<<endl;
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2