返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int h1=0;
  7.     int h2=0;
  8.     int h3=0;
  9.     int h4=0;
  10.     int random=0;
  11.     int round=1;
  12.     srand(time(NULL));
  13.     while(true)
  14.     {
  15.     cout<<"第"<<round<<"局"<<endl;
  16.     cout<<"「好事成雙」賽馬場"<<endl;
  17.     cout<<"|-------------------------------------------------------------------------|終點"<<endl;                                                                        
  18.     cout<<"◆"<<endl;
  19.     cout<<"★"<<endl;
  20.     cout<<"▲"<<endl;
  21.     cout<<"●"<<endl;
  22.     cout<<"(1)下注\t\t(2)錢包\t\t(3)";
  23.     system("pause");
  24.     while(h1!=75&&h2!=75&&h3!=75&&h4!=75)
  25.     {
  26.         random=rand()%4;
  27.         if(random==0)
  28.         {
  29.             h1++;
  30.         }
  31.         if(random==1)
  32.         {
  33.             h2++;
  34.         }
  35.         if(random==2)
  36.         {
  37.             h3++;
  38.         }
  39.         if(random==3)
  40.         {
  41.             h4++;
  42.         }
  43.         cout<<"比賽進行中"<<endl;
  44.         cout<<"|-------------------------------------------------------------------------|終點"<<endl;
  45.         for(int i=0;i<=h1;i++)
  46.         {
  47.                 cout<<" ";
  48.         }
  49.         cout<<"◆"<<endl;
  50.         for(int i=0;i<=h2;i++)
  51.         {
  52.                 cout<<" ";
  53.         }
  54.         cout<<"★"<<endl;
  55.         for(int i=0;i<=h3;i++)
  56.         {
  57.                 cout<<" ";
  58.         }
  59.         cout<<"▲"<<endl;
  60.         for(int i=0;i<=h4;i++)
  61.         {
  62.                 cout<<" ";
  63.         }
  64.         cout<<"●"<<endl;
  65.         system("cls");
  66.     }
  67.     round++;
  68.     system("cls");
  69.     cout<<"比賽結束! 由";
  70.     if(h1==75)
  71.     {
  72.               cout<<"◆搶先得馳"<<endl;
  73.     }
  74.     if(h2==75)
  75.     {
  76.               cout<<"★搶先得馳"<<endl;
  77.     }
  78.     if(h3==75)
  79.     {
  80.               cout<<"▲搶先得馳"<<endl;
  81.     }
  82.     if(h4==75)
  83.     {
  84.               cout<<"●搶先得馳"<<endl;
  85.     }
  86.     }
  87.     system("pause");        
  88.     return 0;
  89. }
複製代碼

TOP

返回列表