返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x;
  7.     string n[]={"飯","麵","粥","漢堡","火鍋"};
  8.     cout<<"☆★☆抽籤程式☆★☆"<<endl;
  9.     cout<<"今晚你要吃什麼?\n"<<endl;
  10.     system("pause");
  11.     system("cls");
  12.     srand(time(NULL));
  13.     for(int i=1;i<=150;i++)
  14.     {
  15.         x=rand()%5;
  16.         if(i%2==0)
  17.         {
  18.             cout<<"☆★☆抽籤中☆★☆"<<endl;
  19.         }
  20.         else
  21.         {
  22.             cout<<"★☆★抽籤中★☆★"<<endl;   
  23.         }
  24.         cout<<n[x]<<endl;
  25.         system("cls");            
  26.     }
  27.     cout<<"今晚選中的食物是:"<<n[x]<<endl;
  28.     system("pause");
  29.     return 0;   
  30. }
複製代碼

TOP

返回列表