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

TOP

返回列表