返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<ctime>
  4. using namespace std;
  5. int main()
  6. {
  7.     int a=1;
  8.     int sum=0, x, money, money2, n;
  9.     re:
  10.     system("cls");
  11.     srand(time(NULL));
  12.     int s[]={0,0,0,0};
  13.     cout<<"「好事成雙」賽馬場 第 "<<a<<" 局"<<endl;
  14.     cout<<"-------------------------------------------------------------------------| 終點"<<endl;
  15.     cout<<"◆"<<endl;
  16.     cout<<"★"<<endl;
  17.     cout<<"▲"<<endl;
  18.     cout<<"●"<<endl;
  19.     {
  20.         cout<<"可用餘額:"<<sum<<"元"<<endl<<endl;
  21.         cout<<"(1)買入  (2)下注  (3)離開  請選擇:";
  22.         cin>>x;
  23.         if(x==1)
  24.         {
  25.             cout<<"買入: ";
  26.             cin>>money;
  27.             sum+=money;
  28.             system("cls");
  29.             goto re;
  30.         }
  31.         else if(x==2)
  32.         {
  33.             cout<<"下注: ";
  34.             cin>>money2;
  35.             cout<<endl;
  36.             cout<<"(1)◆ (2)★ (3)▲ (4)●  請選擇:";
  37.             cin>>n;
  38.             if(n>4)
  39.             {
  40.             system("cls");
  41.             goto re;
  42.             }
  43.             else
  44.             {
  45.             cout<<"比賽即將開始..."<<endl<<endl;
  46.             system("pause");
  47.             }
  48.         }
  49.     }
  50.     while(true)
  51.     {
  52.         system("cls");
  53.         int r=rand()%4;
  54.         s[r]++;
  55.         cout<<"比賽進行中"<<endl;
  56.         cout<<"-------------------------------------------------------------------------| 終點"<<endl;
  57.         for(int i=0; i<=s[0]; i++)
  58.             cout<<" ";
  59.         cout<<"◆"<<endl;
  60.         for(int i=0; i<=s[1]; i++)
  61.             cout<<" ";
  62.         cout<<"★"<<endl;
  63.         for(int i=0; i<=s[2]; i++)
  64.             cout<<" ";
  65.         cout<<"▲"<<endl;
  66.         for(int i=0; i<=s[3]; i++)
  67.             cout<<" ";
  68.         cout<<"●"<<endl;
  69.         if(s[r]==73)
  70.             break;
  71.         _sleep(0.00000001);
  72.     }
  73.     system("cls");
  74.     cout<<"比賽結束 ";
  75.     if(s[0]==73)
  76.         cout<<"由◆先馳得點!"<<endl;
  77.     if(s[1]==73)
  78.         cout<<"由★先馳得點!"<<endl;
  79.     if(s[2]==73)
  80.         cout<<"由▲先馳得點!"<<endl;
  81.     if(s[3]==73)
  82.         cout<<"由●先馳得點!"<<endl;
  83.     cout<<"-------------------------------------------------------------------------| 終點"<<endl;
  84.     for(int i=0; i<=s[0]; i++)
  85.         cout<<" ";
  86.     cout<<"◆"<<endl;
  87.     for(int i=0; i<=s[1]; i++)
  88.         cout<<" ";
  89.     cout<<"★"<<endl;
  90.     for(int i=0; i<=s[2]; i++)
  91.         cout<<" ";
  92.     cout<<"▲"<<endl;
  93.     for(int i=0; i<=s[3]; i++)
  94.         cout<<" ";
  95.     cout<<"●"<<endl;
  96.     system("pause");
  97.     a++;
  98.     goto re;
  99.     return 0;
  100. }
複製代碼

TOP

返回列表