返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<time.h>
  4. using namespace std;
  5. int main()
  6. {
  7.   int times=1;
  8.   int point=0;
  9.   int select=0;
  10.   int buy=0;
  11.   while(true)
  12.   {
  13.     int h1=0, h2=0, h3=0, h4=0, random=0;
  14.     srand(time(NULL));
  15.     cout<<"「好事成雙」賽馬場"<<"第"<<times <<"局"<<endl;
  16.     cout<<"------------------------------------------------------------------------| 終點"<<endl;
  17.     cout<<"ω"<<endl;
  18.     cout<<"£"<<endl;
  19.     cout<<"Θ"<<endl;
  20.     cout<<"卍"<<endl;
  21.     cout<<"可用餘額:"<<point<<endl;
  22.     cout<<"(1)買入 (2)下注 (3)離開 請選擇:";
  23.     cin>>select;
  24.     if(select==1)
  25.     {
  26.      cout<<"買入:";
  27.      cin>>buy;
  28.      cout<<"可用餘額:"<<endl;
  29.      select=buy;  
  30.     }
  31.      if(select==2)
  32.     {
  33.      
  34.     }
  35.      if(select==3)
  36.     {
  37.   
  38.     }
  39.     system("pause");
  40.     system("cls");
  41.    
  42.     while(h1!=75 && h2!=75 && h3!=75 && h4!=75)
  43.     {
  44.         random=rand()%4;   
  45.         if(random==0) {
  46.            h1++;
  47.         }  
  48.         else if(random==1) {
  49.            h2++;
  50.         }
  51.         else if(random==2) {
  52.            h3++;
  53.         }
  54.         else if(random==3) {
  55.            h4++;
  56.         }
  57.         cout<<"比賽進行中"<<endl;
  58.         cout<<"------------------------------------------------------------------------| 終點"<<endl;
  59.       
  60.         for(int i=1; i<=h1; i++) {
  61.            cout<<" ";
  62.         }   
  63.         cout<<"ω"<<endl;
  64.         
  65.         for(int i=1; i<=h2; i++) {
  66.            cout<<" ";
  67.         }   
  68.         cout<<"£"<<endl;
  69.         
  70.          for(int i=1; i<=h3; i++) {
  71.            cout<<" ";
  72.         }   
  73.         cout<<"Θ"<<endl;
  74.         
  75.          for(int i=1; i<=h4; i++) {
  76.            cout<<" ";
  77.         }   
  78.         cout<<"卍"<<endl;
  79.         system("cls");      
  80.     }
  81.        if(h1==75)
  82.        {  
  83.        cout<<"由ω先馳得點"<<endl;      
  84.        }     
  85.        else if(h2==75)
  86.        {  
  87.        cout<<"由£先馳得點"<<endl;      
  88.        }     
  89.        else if(h3==75)
  90.        {  
  91.        cout<<"由Θ先馳得點"<<endl;      
  92.        }     
  93.        else if(h4==75)
  94.        {  
  95.        cout<<"由卍先馳得點"<<endl;      
  96.        }   
  97.        times++;   
  98.     }

  99.     system("pause");
  100.     return 0;
  101.       
  102. }
複製代碼

TOP

返回列表