標題:
[作業] 抽籤程式 (二)
[打印本頁]
作者:
may
時間:
2021-1-23 11:25
標題:
[作業] 抽籤程式 (二)
延續
抽籤程式 (一)
的練習,使在接近顯示抽籤結果時,洗牌的速度漸漸慢下來。
抽籤程式v2.exe
本帖隱藏的內容需要回復才可以瀏覽
作者:
許洧熏
時間:
2021-1-23 20:03
[attach]11264[/attach]
作者:
黃子倢
時間:
2021-1-23 21:03
#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<=15; i++)
{
if(i%2==1)
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
else
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
cout<<food[rand()%6]<<endl;
_sleep(50);
system("cls");
}
for(int i=1; i<=7; i++)
{
if(i%2==1)
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
else
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
cout<<food[rand()%6]<<endl;
_sleep(100);
system("cls");
}
for(int i=1; i<=7; 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;
}
複製代碼
作者:
余柏緯
時間:
2021-1-26 14:23
本帖最後由 余柏緯 於 2021-1-30 19:53 編輯
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
string food[]={"焗烤","牛排","滷肉飯","粥","漢堡","炸雞"};
srand(time(NULL));
re:
system("cls");
cout<<"□■□抽籤程式 □■□"<<endl;
cout<<"今天晚餐\吃什麼?"<<endl;
system("pause");
for(int i=1; i<=52; i++)
{
if(i%2==1)
cout<<"□■□ 抽籤中 □■□"<<endl;
else
cout<<"■□■ 抽籤中 ■□■"<<endl;
cout<<food[rand()%6]<<"!"<<endl;
if(i<=30)
_sleep(20);
else
_sleep(20+(i-30)*(i-30);
system("cls");
}
cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
朱奕祐
時間:
2021-1-29 16:39
本帖最後由 朱奕祐 於 2021-1-30 19:50 編輯
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
string food[]={"咖哩飯","牛排","餿水","薯條","漢堡","屎"};
srand(time(NULL));
re:
system("cls");
cout<<"○●○抽籤程式 ○●○"<<endl;
cout<<"今天晚餐\吃什麼?"<<endl;
system("pause");
for(int i=50; i<=120; i++)
{
if(i%2==1)
cout<<"○●○ 抽籤中 ○●○"<<endl;
else
cout<<"●○● 抽籤中 ●○●"<<endl;
cout<<food[rand()%6]<<"!"<<endl;
_sleep(i);
system("cls");
}
cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
呂尚霖
時間:
2021-1-29 22:34
本帖最後由 呂尚霖 於 2021-1-30 19:47 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string food[]={"可樂","牛排","甜甜圈","意麵","豬大便","核彈"};
srand(time(NULL));
re:
system("cls");
cout<<"☆★☆ 抽籤程式 ☆★☆"<<endl;
cout<<"今天晚餐吃什麼?"<<endl<<endl;
system("pause");
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
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");
}
for(int i=1; i<=23; i++)
{
if(i%2==1)
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
else
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
cout<<food[rand()%6]<<"!"<<endl;
_sleep(111);
system("cls");
}
for(int i=1; i<=15; i++)
{
if(i%2==1)
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
else
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
cout<<food[rand()%6]<<"!"<<endl;
_sleep(144);
system("cls");
}
cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
許洧熏
時間:
2021-1-30 07:35
本帖最後由 許洧熏 於 2021-1-30 19:48 編輯
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
string f[]={"雞","豬","牛","羊","藥","鍋"};
srand(time(NULL));
re:
system("cls");
cout<<"*** 抽籤 ***"<<endl;
cout<<"今天晚餐\吃什麼?"<<endl<<endl;
system("pause");
for(int y=1; y<=52; y++)
{
if(y%2==1)
cout<<"★☆★ 抽籤ing ★☆★"<<endl;
else
cout<<"☆★☆ 抽籤ing ☆★☆"<<endl;
cout<<f[rand()%6]<<"!"<<endl;
if(y<=30)
_sleep(20);
else
_sleep(20+(y-30)*(y-30));
system("cls");
}
cout<<"吃: "<<f[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
may
時間:
2021-1-30 11:19
標題:
RE: [作業] 抽籤程式 (二)流程圖
[attach]11340[/attach]
作者:
俞成章
時間:
2021-1-30 19:45
#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<=52; i++)
{
if(i%2==1)
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
else
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
cout<<food[rand()%6]<<"!"<<endl;
if(i<=30)
_sleep(20);
else
_sleep(20+(i-30)*(i-30));
system("cls");
}
cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
王宇崴
時間:
2021-1-30 19:47
#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<=52; i++)
{
if(i%2==1)
cout<<"*** 抽籤 ***"<<endl;
else
cout<<"*** 抽籤 ***"<<endl;
cout<<food[rand()%6]<<"!"<<endl;
if(i<=30)
_sleep(20);
else
_sleep(20+(i-30)*(i-30));
system("cls");
}
cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
林鼎傑
時間:
2021-1-30 19:48
#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<=55; i++)
{
if(i%2==1)
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
else
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
cout<<food[rand()%8]<<"!"<<endl;
if(i<=30)
_sleep(20);
else
_sleep(20+(i-30)*(i-30));
system("cls");
}
cout<<"吃: "<<food[rand()%8]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
王秉鈞
時間:
2021-1-30 20:06
#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<=52;i++)
{
if(i%2==1)
cout<<"■正在抽籤■"<<endl;
else
cout<<"□正在抽籤□"<<endl;
cout<<food[rand()%4]<<"!"<<endl;
if(i<=30)
_sleep(20);
else
_sleep (20+(i-30)*(i-30));
system("cls");
}
cout<<"吃"<<food[rand()&4]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
黃子倢
時間:
2021-2-19 09:17
#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<=50; i++)
{
if(i%2==1)
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
else
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
cout<<food[rand()%6]<<endl;
_sleep(i*3);
system("cls");
}
cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
黃子倢
時間:
2021-2-19 09: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<=50; i++)
{
if(i%2==1)
cout<<"★☆★ 抽籤中 ★☆★"<<endl;
else
cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
cout<<food[rand()%6]<<endl;
if(i<20)
{
_sleep(50);
}
else
{
_sleep(60+(i-20)*(i-20));
}
system("cls");
}
cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2