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

TOP

返回列表