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

TOP

返回列表