返回列表 發帖
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int n=0;
  4. int main()
  5. {
  6.     re:
  7.     n++;
  8.     system("cls");
  9.     int s[4]= {0,0,0,0};
  10.     string p[4]= {"馬1","馬2","馬3","馬4"};
  11.     int r;
  12.     srand(time(NULL));
  13.     cout<<"[好事成雙]賽馬場 第"<<n<<"局"<<endl;
  14.     cout<<"-------------------------------------------------------------------------|終點"<<endl;
  15.     for(int i=0; i<4; i++)
  16.     {
  17.         cout<<p[i]<<endl;
  18.     }
  19.     system("pause");
  20.     system("cls");
  21.     while(s[r]<=74)
  22.     {
  23.         r=rand()%4;
  24.         s[r]++;
  25.         cout<<"比賽進行中"<<endl;
  26.         cout<<"-----------------------------------------------------------------------------|終點"<<endl;

  27.         for(int i=0; i<=3; i++)
  28.         {
  29.             for(int j=0; j<s[i]; j++)
  30.             {
  31.                 cout<<" ";
  32.             }
  33.             cout<<p[i]<<endl;

  34.         }
  35.         _sleep(50);
  36.         system("cls");
  37.     }
  38.     cout<<"比賽結束,由"<<p[r]<<"先馳得點!"<<endl;
  39.     cout<<"-------------------------------------------------------------------------|終點"<<endl;
  40.     for(int i=0; i<=3; i++)
  41.     {
  42.         for(int j=0; j<s[i]; j++)
  43.         {
  44.             cout<<" ";
  45.         }

  46.         cout<<p[i]<<endl;

  47.     }
  48.     goto re;
  49.     system("pause");
  50.     return 0;
  51. }
複製代碼

TOP

返回列表