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

TOP

返回列表