返回列表 發帖
本帖最後由 呂尚霖 於 2021-1-30 19:47 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    string food[]={"可樂","牛排","甜甜圈","意麵","豬大便","核彈"};
  7.    srand(time(NULL));
  8.    re:
  9.    system("cls");
  10.    cout<<"☆★☆ 抽籤程式 ☆★☆"<<endl;
  11.    cout<<"今天晚餐吃什麼?"<<endl<<endl;
  12.    system("pause");
  13.             cout<<"★☆★ 抽籤中 ★☆★"<<endl;
  14.    for(int i=1; i<=30; i++)
  15.    {
  16.         if(i%2==1)
  17.             cout<<"★☆★ 抽籤中 ★☆★"<<endl;
  18.         else
  19.             cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
  20.         cout<<food[rand()%6]<<"!"<<endl;
  21.         _sleep(50);
  22.         system("cls");   
  23.    }
  24.    for(int i=1; i<=23; i++)
  25.    {
  26.         if(i%2==1)
  27.             cout<<"★☆★ 抽籤中 ★☆★"<<endl;
  28.         else
  29.             cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
  30.         cout<<food[rand()%6]<<"!"<<endl;
  31.         _sleep(111);
  32.         system("cls");   
  33.    }
  34.    for(int i=1; i<=15; i++)
  35.    {
  36.         if(i%2==1)
  37.             cout<<"★☆★ 抽籤中 ★☆★"<<endl;
  38.         else
  39.             cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;
  40.         cout<<food[rand()%6]<<"!"<<endl;
  41.         _sleep(144);
  42.         system("cls");   
  43.    }
  44.    cout<<"吃: "<<food[rand()%6]<<"!"<<endl<<endl;
  45.    system("pause");
  46.    goto re;   
  47.    return 0;
  48. }   
複製代碼

TOP

返回列表