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

TOP

返回列表