標題:
抽籤程式 (一)
[打印本頁]
作者:
tonyh
時間:
2017-4-22 14:44
標題:
抽籤程式 (一)
本帖最後由 tonyh 於 2019-9-17 21:11 編輯
發揮創意想想看, 抽籤程式在日生活中甚麼時候可以派上用場呢?
(ex. 要吃什麼、誰掃廁所、玩遊戲輸了做什麼處罰...)
[attach]2171[/attach]
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string food[]={"漢堡","牛排","羊肉爐","意麵","大便","餿水"};
srand(time(NULL));
re:
system("cls");
cout<<"☆★☆ 抽籤程式 ☆★☆"<<endl;
cout<<"今天晚餐\吃什麼?"<<endl<<endl;
system("pause");
for(int i=1; i<=30; i++)
{
if(i%2==1)
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
else
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
cout<<food[rand()%6]<<"!"<<endl;
_sleep(50);
system("cls");
}
cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
蔡幸融
時間:
2017-4-22 15:25
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
srand(time(NULL));
string food[]={"牛肉","雞肉","羊肉","魚肉","豬肉","狗肉","貓肉","人肉","馬肉"};
cout<<"★☆★ 抽籤程式 ★☆★"<<endl;
cout<<"今天晚餐\吃什麼?"<<endl;
system("pause");
for(int i=1; i<=50; i++)
{
if(i%2==1)
{
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
}else
{
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
}
cout<<food[rand()%9]<<endl;
system("cls");
}
cout<<"吃"<<food[rand()%9]<<"!"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
蕭澧邦
時間:
2017-4-22 15:25
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
srand(time(NULL));
string food[]={"漢堡", "牛排", "炒飯", "意麵", "大便"};
cout<<"☆★☆ 抽籤程式 ☆★☆"<<endl;
cout<<"今天晚餐\吃甚麼?"<<endl;
system("pause");
for(int i=1; i<=50; i++)
{
if(i%2==1)
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
else
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
cout<<food[rand()%5]<<endl;
system("cls");
}
cout<<"吃"<<food[rand()%5]<<endl;
system("pause");
return 0;
}
複製代碼
作者:
許紘誌
時間:
2017-4-22 15:26
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string food[]={"炒飯","燴飯","意麵","義大利麵","大便"};
srand(time(NULL));
re:
system("cls");
cout<<"☆★☆ 抽籤程式 ☆★☆"<<endl;
cout<<"今天晚餐\吃什麼?"<<endl<<endl;
system("pause");
for(int i=1; i<=30; i++)
{
if(i%2==1)
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
else
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
cout<<food[rand()%5]<<"!"<<endl;
_sleep(50);
system("cls");
}
cout<<"吃: "<<food[rand()%5]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
譚暐霖
時間:
2017-4-22 15:30
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string food[]={"漢堡","牛排","羊肉爐","意麵","大便","餿水"};
srand(time(NULL));
re:
system("cls");
cout<<"☆★☆ 抽籤程式 ☆★☆"<<endl;
cout<<"今天晚餐\吃什麼?"<<endl<<endl;
system("pause");
for(int i=1; i<=30; i++)
{
if(i%2==1)
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
else
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
cout<<food[rand()%6]<<"!"<<endl;
_sleep(50);
system("cls");
}
cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
洪榜蔓
時間:
2017-4-28 19:28
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string food[]={"布丁","果凍","冰淇淋","巧克力","軟糖","狗屎"};
srand(time(NULL));
re:
system("cls");
cout<<"☆★☆ 抽籤程式 ☆★☆"<<endl;
cout<<"今天點心吃什麼呢???"<<endl<<endl;
system("pause");
for(int i=1; i<=30; i++)
{
if(i%2==1)
cout<<"★☆★...正在抽籤中...★☆★"<<endl;
else
cout<<"☆★☆...正在抽籤中...☆★☆"<<endl;
cout<<food[rand()%6]<<"!"<<endl;
_sleep(50);
system("cls");
}
cout<<"今天點心吃"<<food[rand()%6]<<"呦!!!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
黃宥鈞
時間:
2017-4-28 20:05
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string food[]={"漢堡","牛排","羊肉爐","意麵","大便","餿水"};
srand(time(NULL));
re:
system("cls");
cout<<"☆★☆ 抽籤程式 ☆★☆"<<endl;
cout<<"今天晚餐\吃什麼?"<<endl<<endl;
system("pause");
for(int i=1; i<=30; i++)
{
if(i%2==1)
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
else
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
cout<<food[rand()%6]<<"!"<<endl;
_sleep(50);
system("cls");
}
cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2