本帖最後由 朱奕祐 於 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;
- }
複製代碼 |