標題:
抽籤程式
[打印本頁]
作者:
陳品肇
時間:
2018-11-23 22:41
標題:
抽籤程式
發揮創意想想看, 抽籤程式在日生活中甚麼時候可以派上用場呢?
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[5]={"漢堡","牛排","意麵","炒飯","大便"};
int ball;
srand(time(NULL));
cout<<"☆★☆ 抽籤程式 ☆★☆"<<endl;
cout<<"今天晚餐\吃甚麼?"<<endl<<endl;
system("pause");
system("cls"); //清畫面
for(int i=0; i<=150; i++)
{
ball=rand()%5; //產生介於 0~4 的隨機亂數
if(i%2==0)
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
else
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
cout<<name[ball]<<endl;
system("cls");
}
cout<<"吃: "<<name[ball]<<"!"<<endl<<endl;
system("pause");
return 0;
}
複製代碼
作者:
蔡依宸
時間:
2018-11-24 16:50
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[5]={"林肯豪華餐\","貓屎","猴屎","雞屎","人屎"};
int ball;
srand(time(NULL));
cout<<"☆★☆抽籤程式☆★☆"<<endl;
cout<<"晚餐\吃什麼"<<endl;
system("pause");
for(int i=0;i<=200;i++)
{
ball=rand()%5;
if(i%2==0)
{
cout<<"☆★☆抽籤中☆★☆"<<endl;
}else
{
cout<<"★☆★抽籤中★☆★"<<endl;
}
cout<<name[ball]<<endl;
system("cls");
}
cout<<"吃: "<<name[ball]<<"!"<<endl<<endl;
system("pause");
return 0;
}
複製代碼
作者:
陳柏霖
時間:
2018-11-24 16:50
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string food[]={"咖哩","義大利麵","壽司","漢堡","屎"};
int eat;
srand(time(NULL));
cout<<"★☆★抽籤程式★☆★"<<endl;
cout<<"今天晚餐\要吃什麼?"<<endl<<endl;
system("pause");
for(int i=0; i<=100; i++)
{
eat=rand()%5+0;
if(i%2==0)
{
cout<<"★☆★抽籤程式★☆★"<<endl;
}else
{
cout<<"☆★☆抽籤程式☆★☆"<<endl;
}
cout<<food[eat]<<endl;
system("cls");
}
cout<<"今天晚餐\吃"<<food[eat]<<endl;
system("pause");
return 0;
}
複製代碼
作者:
戴唯陞
時間:
2018-11-24 16:53
本帖最後由 戴唯陞 於 2018-11-24 17:02 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string food [5]={"炸雞","薯條","蛋糕","喝水","喝西北風"};
int ball;
srand(time(NULL));
cout<<"來抽抽看 今天晚餐吃甚麼?"<<endl;
system("pause");
system("cls");
for(int i=0; i<=10; i++)
{
ball=rand()%5;
if(i%2==0)
cout<<"抽籤中 請稍後"<<endl;
else
cout<<"抽籤中 請稍後"<<endl;
cout<<food[ball]<<endl;
system("cls");
}
cout<<"吃 "<<food[ball]<<endl<<endl;
system("pause");
return 0;
}
複製代碼
作者:
戴安利
時間:
2018-11-24 16:56
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[5]={"漢堡","牛排","意麵","炒飯","大便"};
int a;
srand(time(NULL));
cout<<"*-*-*-*-*-*抽籤程式*-*-*-*-*-*"<<endl;
cout<<"今天晚餐\吃甚麼?"<<endl<<endl;
system("pause");
system("cls");
for(int i=0; i<=15; i++)
{
a=rand()%5;
if(i%2==0)
cout<<"*-*-*-*-*-*抽籤程式*-*-*-*-*-*"<<endl;
else
cout<<"*-*-*抽籤中*-*-*"<<endl;
cout<<name[a]<<endl;
system("cls");
}
cout<<"吃: "<<name[a]<<"!!!!!"<<endl<<endl;
system("pause");
return 0;
}
複製代碼
作者:
蔡季庭
時間:
2018-11-24 16:59
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[]={"漢堡","牛排","意麵","炒飯","大便","尿尿","薯條","果汁",
"祕魯","米酒","即拿棒","泡麵","牛肉乾","起獅堂","風水堂","牛後腿","羊小排",
"老虎牙子","哈里波特龍睪丸"};
int ball;
srand(time(NULL));
cout<<"☆★☆ 抽籤程式 ☆★☆"<<endl;
cout<<"晚餐\吃甚麼?"<<endl<<endl;
cout<<"please press ENTER"<<endl<<endl;
system("pause");
for(int i=0; i<=150; i++)
{
ball=rand()%19;
if(i%2==0)
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
else
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
cout<<name[ball]<<endl;
system("cls");
}
cout<<"今晚吃: "<<name[ball]<<"!"<<endl<<endl;
system("pause");
return 0;
}
複製代碼
作者:
戴偉宸
時間:
2018-11-24 17:02
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[5]={"漢堡","牛排","意麵","炒飯","水餃"};
int food;
srand(time(NULL));
cout<<"***抽籤程式***"<<endl;
cout<<"今天晚餐\吃甚麼?"<<endl<<endl;
system("pause");
system("cls");
for(int i=0;i<=150;i++)
{
food=rand()%5;
if(i%2==0)
cout<<"OXO抽籤中OXO"<<endl;
else
cout<<"XOX抽籤中XOX"<<endl;
cout<<"name[food]"<<endl;
system("cls");
}
cout<<"吃:"<<name[food]<<"!"<<endl<<endl;
system("pause");
return 0;
}
複製代碼
作者:
譚詩澐
時間:
2018-12-1 17:15
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[5]={"白飯","牛排","麵","炒飯","大便"};
int ball;
srand(time(NULL));
cout<<"☆★☆ 抽籤程式 ☆★☆"<<endl;
cout<<"今天晚餐\吃甚麼?"<<endl<<endl;
system("pause");
system("cls");
for(int i=0; i<=150; i++)
{
ball=rand()%5;
if(i%2==0)
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
else
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
cout<<name[ball]<<endl;
system("cls");
}
cout<<"吃: "<<name[ball]<<"!"<<endl<<endl;
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2