返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<ctime>
  4. using namespace std;
  5. int main()
  6. {   
  7.     srand(time(NULL));
  8.     string food[]={"牛肉","雞肉","羊肉","魚肉","豬肉","狗肉","貓肉","人肉","馬肉"};
  9.     cout<<"★☆★ 抽籤程式 ★☆★"<<endl;
  10.     cout<<"今天晚餐\吃什麼?"<<endl;
  11.     system("pause");
  12.     for(int i=1; i<=50; i++)
  13.     {
  14.         if(i%2==1)
  15.         {
  16.             cout<<"☆★☆ 抽籤中 ☆★☆"<<endl;         
  17.         }else
  18.         {
  19.             cout<<"★☆★ 抽籤中 ★☆★"<<endl;
  20.         }
  21.         cout<<food[rand()%9]<<endl;
  22.         system("cls");
  23.     }
  24.     cout<<"吃"<<food[rand()%9]<<"!"<<endl;
  25.    
  26.     system("pause");
  27.     return 0;
  28. }
複製代碼

TOP

返回列表