返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<time.h>  
  4. using namespace std;
  5. int main()
  6. {
  7.     int a1=0,a2=0,a3=0,a4=0,random=0;
  8.     int times=1 ;
  9.     int money=0;
  10.     int select=0;
  11.     int trade=0;
  12.     srand(time(NULL));
  13.     while(true)
  14.      int a1=0, a2=0, a3=0, a4=0, random=0;
  15.   srand(time(NULL));
  16.   cout<<"可用餘額:"<<money<<"元"<<endl;
  17.   cout<<"(1)儲值(2)下注(3)離開";
  18.   cin>>select;
  19.   if(select==1)
  20.   {
  21.   cout<<"輸入儲值金額:";
  22.   cin>>trade;
  23.   money=trade;
  24.   }
  25.   if(select==2)
  26.   {

  27.   }
  28.   if(select==3)
  29.   {

  30.   }
  31.     {
  32.     cout<<"「好事成雙」賽馬場   " << "第 " <<times << "局 "<<endl;
  33.     cout<<"-------------------------------------------------------------------------[終點"<<endl;
  34.     cout<<"●"<<endl;
  35.     cout<<"▼"<<endl;
  36.     cout<<"■"<<endl;
  37.     cout<<"★"<<endl;
  38.     system("pause");
  39.     while(a1!=75&&a2!=75&&a3!=75&&a4!=75)
  40.     {
  41.        random=rand()%4;
  42.      if(random==0) {
  43.            a1++;
  44.         }  
  45.         else if(random==1)
  46.         {
  47.            a2++;
  48.         }
  49.         else if(random==2)
  50.         {
  51.            a3++;
  52.         }
  53.         else if(random==3)
  54.         {
  55.            a4++;
  56.         }
  57.       
  58.          cout<<"「好事成雙」賽馬場"<<"第"<<times<<"局"<<endl;
  59.          cout<<"-------------------------------------------------------------[終點"<<endl;
  60.         for(int i=1; i<=a1; i++)
  61.         {
  62.            cout<<" ";
  63.         }   
  64.         cout<<"◆"<<endl;
  65.         
  66.         for(int i=1; i<=a2; i++)
  67.         {
  68.            cout<<" ";
  69.         }   
  70.         cout<<"★"<<endl;
  71.         
  72.          for(int i=1; i<=a3; i++) {
  73.            cout<<" ";
  74.         }   
  75.         cout<<"▲"<<endl;
  76.         
  77.          for(int i=1; i<=a4; i++) {
  78.            cout<<" ";
  79.         }   
  80.         cout<<"●"<<endl;      
  81.         system("cls");
  82.     }
  83.     times++ ;
  84.     system("cls");
  85.    
  86.     if(a1==75)
  87.     {
  88.               cout<<"比賽結束 由:◆獲勝"<<endl;
  89.     }
  90.     else if(a2==75)
  91.     {
  92.               cout<<"比賽結束 由:★獲勝"<<endl;
  93.     }
  94.     else if(a3==75)
  95.     {
  96.               cout<<"比賽結束 由:▲獲勝"<<endl;
  97.     }
  98.     else if(a4==75)
  99.     {
  100.               cout<<"比賽結束 由:●獲勝"<<endl;
  101.     }  
  102.     }   
  103.     system("pause");
  104.     return 0;
  105.       
  106. }
複製代碼

TOP

返回列表