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

TOP

返回列表