標題:
抽籤程式 (一)
[打印本頁]
作者:
鄭繼威
時間:
2023-2-24 00:15
標題:
抽籤程式 (一)
本帖最後由 鄭繼威 於 2023-2-24 00:18 編輯
發揮創意想想看, 抽籤程式在日生活中甚麼時候可以派上用場呢?
(ex. 要吃什麼、誰掃廁所、玩遊戲輸了做什麼處罰...)
抽籤程式流程圖.pdf
抽籤程式.exe
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
string food[]={"漢堡","牛排","羊肉爐","意麵","大便","餿水"};
srand(time(NULL));
re:
system("cls");
cout<<"☆★☆ 抽籤程式 ☆★☆"<<endl;
cout<<"今天晚餐\吃什麼?"<<endl<<endl;
system("pause");
//開始抽籤(30次)
for(int i=1; i<=30; i++)
{
//做動畫
if(i%2==1)
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
else
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
cout<<food[rand()%6]<<"!"<<endl; //rand()%6->0~5
_sleep(50); //決定動畫的速度
system("cls");
}
cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
陳宥霖
時間:
2023-2-25 15:09
#include<iostream>
#include<cstdlib>
#include<ctime>
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(200);
system("cls");
}
cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
吳俊頡
時間:
2023-2-25 15:10
#include<iostream>
#include<cstdlib>
#include<ctime>
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()%7]<<"!"<<endl;
_sleep(50);
system("cls");
}
cout<<"吃: "<<food[rand()%7]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
楊芊琦
時間:
2023-2-25 15:14
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
int ww = 0;
cout<<"----遊樂設施挑戰死亡抽籤----"<<endl;
cout<<"誰要挑戰呢";
while(ww!=4)
{
ww+=1;
_sleep(300);
cout<<".";
}
cout<<endl;
srand(time(NULL));
string ch[] = {"老子","荀子","孔子","孟子"} ;
for(int y=0;y<=99;y++)
{
if(y%2==0)
{
cout<<"-*-抽籤中-*-"<<endl;
_sleep(60);
}
else
{
cout<<"*-*抽籤中*-*"<<endl;
_sleep(60);
}
}
cout<<"恭喜"<<ch[rand()%4]<<"被選中了"<<endl;
cout<<"我們為他默哀"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
翁川祐
時間:
2023-2-25 15:14
#include<iostream>
#include<cstdlib>
#include<ctime>
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<=50; i++)
{
if(i%2==1)
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
else if
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
cout<<food[rand()%6]<<"!"<<endl;
_sleep(50);
system("cls");
}
cout<<"吃"<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
徐啟祐
時間:
2023-2-25 15:15
#include<iostream>
#include<cstdlib>
#include<ctime>
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(10);
system("cls");
}
cout<<"吃"<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
system("pause");
return 0;
}
複製代碼
作者:
葉佳和
時間:
2023-2-25 15:18
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
string food[]={"漢堡","牛排","羊肉爐","意麵","大便","餿水"};
srand(time(NULL));
re:
system("cls");
cout<<"☆★☆ 抽籤程式 ☆★☆"<<endl;
cout<<"今天晚餐\吃什麼?"<<endl;
cout<<"按ENTER開始抽獎!!"<<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<<endl;
//cout<<"吃屎拉你!"<<endl<<endl;
cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
羅紹齊
時間:
2023-2-25 15:19
#include<iostream>
#include<cstdlib>
#include<ctime>
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<=50;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;
}
複製代碼
作者:
宜儒
時間:
2023-3-1 20:42
#include<iostream>
#include<cstdlib>
#include<ctime>
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<<endl;
_sleep(50);
system("cls");
}
cout<<"吃:"<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
陳牧謙
時間:
2023-3-11 13:07
#include<iostream>
#include<cstdlib>
#include<ctime>
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(200);
system("cls");
}
cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2