返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<ctime>
  4. using namespace std;
  5. int main()
  6. {  
  7.     int h[4]={0,0,0,0};
  8.     srand(time(NULL));
  9.     cout<<"[好事雙城]賽馬場"<<endl;
  10.     cout<<"-------------------------------------------------------------------------| 終點"<<endl;
  11.     cout<<"◆"<<endl;
  12.     cout<<"★"<<endl;
  13.     cout<<"▲"<<endl;
  14.     cout<<"●"<<endl;
  15.     system("pause");
  16.     while(true)
  17.     {
  18.         cout<<"比賽進行中......"<<endl;
  19.         int r=rand()%4;
  20.         h[r]++;
  21.         cout<<"-------------------------------------------------------------------------| 終點"<<endl;
  22.         for(int i=1;i<=h[0];i++)
  23.             cout<<" ";
  24.         cout<<"◆"<<endl;
  25.         for(int i=1;i<=h[1];i++)
  26.             cout<<" ";
  27.         cout<<"★"<<endl;
  28.         for(int i=1;i<=h[2];i++)
  29.             cout<<" ";
  30.         cout<<"▲"<<endl;
  31.         for(int i=1;i<=h[3];i++)
  32.             cout<<" ";
  33.         cout<<"●"<<endl;           
  34.         if(h[r]==72)
  35.         {
  36.             break;     
  37.         }
  38.             _sleep(20);
  39.             system("cls");
  40.     }
  41.     system("pause");
  42.     return 0;
  43. }
複製代碼
Jian-wei Wang

TOP

返回列表