返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n;
  7.     string name[5]={"白色","紅色","黃色","綠色","紫色"};
  8.     cout<<"☆★☆抽籤程式☆★☆"<<endl;
  9.     cout<<"今天穿甚麼顏色?"<<endl;
  10.     system("pause");//畫面暫停
  11.     system("cls"); //畫面清空
  12.     srand(time(NULL));
  13.     for(int i=1;i<=100;i++)
  14.     {
  15.         n=rand()%5;
  16.         if(i%2==0)
  17.         {
  18.            cout<<"☆★☆抽籤中☆★☆"<<endl;
  19.         }else
  20.         {
  21.             cout<<"★☆★抽籤中★☆★"<<endl;
  22.         }
  23.    
  24.     cout<<name[n]<<endl;
  25.     system("cls");
  26.     }
  27.     cout<<"今天要穿的顏色是:"<<name[n]<<endl;
  28.     system("pause");
  29.     return 0;
  30. }
複製代碼

TOP

返回列表