返回列表 發帖
  1. #include<bits\stdc++.h>
  2. #include<cstdlib>
  3. using namespace std;
  4. int n=1;
  5. int main()
  6. {
  7.     re:
  8.     system("cls");
  9.     int r;
  10.     srand(time(NULL));
  11.     int s[]={0,0,0,0};
  12.     string a[]={"★","◆","●","▲"};
  13.     cout<<"「好事成雙」賽馬場 第"<<n<<"局"<<endl;
  14.     cout<<"---------------| 終點"<<endl;
  15.     for(int i=0;i<4;i++)
  16.     {
  17.         cout<<a[i]<<endl;
  18.     }
  19.     system("pause");
  20.     system("cls");
  21.     while(s[r]<=15)
  22.     {
  23.         r=rand()%4;
  24.         s[r]++;
  25.         cout<<"比賽進行中"<<endl;
  26.         cout<<"---------------| 終點"<<endl;
  27.         for(int i=0;i<4;i++)
  28.         {
  29.             for(int j=0;j<s[i];j++)
  30.                 cout<<" ";
  31.             cout<<a[i]<<endl;
  32.         }
  33.         _sleep(50);
  34.         system("cls");
  35.     }
  36.     system("cls");
  37.     cout<<"比賽結束"<<endl;
  38.     cout<<"---------------| 終點 由 "<<a[r]<<" 先馳得點!"<<endl;
  39.     for(int i=0;i<4;i++)
  40.         {
  41.             for(int j=0;j<s[i];j++)
  42.                 cout<<" ";
  43.             cout<<a[i]<<endl;
  44.         }
  45.     system("pause");
  46.     n++;
  47.     goto re;
  48.     return 0;
  49. }
複製代碼

TOP

返回列表