返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int s=1,m=0;
  7.     re:
  8.       
  9.     int a=0,b=0,c=0,d=0,r,o,z;
  10.     cout<<"賽馬場 第"<<s<<"局"<<endl;
  11.     cout<<"--------------------------------------------------------------------|終點"<<endl;
  12.    
  13.     cout<<"◆"<<endl;
  14.     cout<<"★"<<endl;
  15.     cout<<"▲"<<endl;
  16.     cout<<"●"<<endl;
  17.     cout<<"可用餘額: "<<m<<"元"<<endl<<endl;
  18.     cout<<"(1)買入 (2)下注 (3)離開 請選擇:";
  19.     cin>>o;
  20.     if(o==1)
  21.     {
  22.             cout<<"買入: ";
  23.             cin>>z;
  24.             m=m+z;
  25.             goto re;
  26.     }        
  27.     system("pause");
  28.     system("cls");
  29.     srand(time(NULL));
  30.    
  31.     while(a!=70 && b!=70 && c!=70 && d!=70)
  32.       {
  33.      cout<<"起跑嘍~~~~~"<<endl;
  34.      cout<<"------------------------------------------------------------------------| 終點"<<endl;         
  35.      
  36.       r = rand()%4+1;   
  37.             if(r==1)
  38.                 a++;  
  39.             if(r==2)
  40.                 b++;  
  41.             if(r==3)
  42.                 c++;  
  43.             if(r==4)
  44.                 d++;
  45.                
  46.              for(int i=0;i<=a;i++)  
  47.              {
  48.                   cout<<" ";
  49.              }
  50.              cout<<"◆"<<endl;
  51.              for(int i=0;i<=b;i++)
  52.              {  
  53.                   cout<<" ";
  54.              }
  55.              cout<<"★"<<endl;
  56.             
  57.              for(int i=0;i<=c;i++)
  58.              {  
  59.                   cout<<" ";
  60.              }
  61.              cout<<"▲"<<endl;
  62.              for(int i=0;i<=d;i++)  
  63.              {     
  64.                    cout<<" ";
  65.              }
  66.              cout<<"●"<<endl;
  67.              system("cls");
  68.       }
  69.       
  70.       cout<<"比賽結束!";
  71.    
  72.       
  73.        cout<<"賽馬結束!";
  74.      if(a==70)
  75.      {
  76.         cout<<"由◆先馳得點!"<<endl;
  77.      }else if(b==70)
  78.      {
  79.         cout<<"由★先馳得點!"<<endl;
  80.      }else if(c==70)
  81.      {
  82.         cout<<"由▲先馳得點!"<<endl;
  83.      }else
  84.      {
  85.         cout<<"由●先馳得點!"<<endl;
  86.      }
  87.      cout<<"------------------------------------------------------------------------| 終點"<<endl;      
  88.      for(int i=0;i<=a;i++)
  89.      {
  90.               cout<<" ";
  91.      }
  92.      cout<<"◆"<<endl;
  93.      for(int i=0;i<=b;i++)
  94.      {
  95.              cout<<" ";
  96.      }
  97.      cout<<"★"<<endl;
  98.      for(int i=0;i<=c;i++)
  99.      {
  100.              cout<<" ";
  101.      }
  102.      cout<<"▲"<<endl;
  103.      for(int i=0;i<=d;i++)
  104.      {
  105.              cout<<" ";
  106.      }
  107.      cout<<"●"<<endl;
  108.      s++;  
  109.       system("pause");
  110.       system("cls");
  111.       goto re;
  112.    
  113.     system("pause");
  114.     return 0;
  115. }
複製代碼

TOP

返回列表