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

TOP

返回列表