返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<ctime>
  4. using namespace std;
  5. int main()
  6. {   
  7.     int f=0;
  8.     int d=1;
  9.     re:
  10.     system("cls");
  11.     int a[]={0,0,0,0};
  12.     string c[]={"◆","★","▲","●"};
  13.     srand(time(NULL));
  14.     int b=0;
  15.     cout<<"賽馬場--第"<<d<<"場"<<endl;
  16.     cout<<"-------------------------------------------------------------------------|終點線"<<endl;
  17.     for(int i=0;i<=3;i++)
  18.     {
  19.        cout<<c[i]<<endl;
  20.     }
  21.     cout<<endl<<"可用餘額:"<<f<<endl<<endl;
  22.     cout<<"(1)儲值 (2)下注 (3)離開 ";
  23.     int g;
  24.     cin>>g;
  25.     if(g==1)
  26.     {
  27.        cout<<"你要儲值多少錢?";
  28.        int h;
  29.        cin>>h;
  30.        f=f+h;
  31.        goto re;
  32.     }
  33.     system("pause");
  34.     system("cls");
  35.         while(true)
  36.         {   
  37.             b=rand()%4;
  38.             a[b]++;
  39.             cout<<"比賽進行中"<<endl;
  40.             cout<<"-------------------------------------------------------------------------|終點線"<<endl;
  41.                
  42.             for(int i=0;i<4;i++)
  43.             {   
  44.             for(int j=0;j<=a[i];j++)
  45.             {
  46.                 cout<<" ";
  47.             }
  48.             cout<<c[i]<<endl;
  49.             }
  50.                 if(a[b]==73)
  51.                 {
  52.                         break;
  53.                 }
  54.                 _sleep(50);
  55.                 system("cls");
  56.         }
  57.                 cout<<"!比賽結束 由"<<c[b]<<"勝利"<<endl;
  58.                 cout<<"-------------------------------------------------------------------------|終點線"<<endl;
  59.                 for(int i=0;i<4;i++)
  60.                 {   
  61.             for(int j=0;j<=a[i];j++)
  62.             {
  63.                           cout<<" ";
  64.             }
  65.             cout<c[i]<<endl;
  66.                 }
  67.                
  68.         system("pause");
  69.         d++;
  70.         goto re;
  71.     return 0;
  72. }
複製代碼

TOP

返回列表