本帖最後由 廖秝瑜 於 2023-6-16 20:38 編輯
- #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<=50; i++)
- {
- if(i%2==1){
- cout<<"★☆★正在抽籤 ★☆★"<<endl;}
- else{
- cout<<"☆★☆ 正在抽籤 ☆★☆"<<endl;
- }
- cout<<food[rand()%6]<<endl;
- _sleep(85);
- system("cls");
- cout<<"吃: "<<food[rand()%6]<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |