返回列表 發帖
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <time.h>
  4. using namespace std;
  5. int main()
  6. {         
  7.     srand(time(NULL));
  8.     int horse1,horse2,horse3,horse4=0;   
  9.     int random;         
  10.     while(true)
  11.     {      
  12.       random=rand()%4;
  13.       if(random==0)
  14.         {
  15.            horse1++;
  16.         }  
  17.         else if(random==1)
  18.         {
  19.            horse2++;
  20.         }
  21.         else if(random==2)
  22.         {
  23.            horse3++;
  24.         }
  25.         else if(random==3)
  26.         {
  27.            horse4++;
  28.         }
  29.     cout<<"「好事成雙」賽馬場"<<endl;
  30.     cout<<"---------------------------------------------------------------------------|終點"<<endl;
  31.     cout<<"★"<<endl;
  32.     cout<<"▲"<<endl;
  33.     cout<<"☆"<<endl;
  34.     cout<<"◆"<<endl;
  35.     while(horse1!=75 || horse2!=75 || horse3!=75 || horse4!=75)           
  36.     {         
  37.         for(int i=0;i<=horse1;i++)
  38.            {
  39.            cout<<" ";   
  40.            }   
  41.          cout<<"★"<<endl;
  42.         for(int i=0;i<=horse2;i++)
  43.            {
  44.            cout<<" ";   
  45.            }   
  46.          cout<<"▲"<<endl;
  47.         for(int i=0;i<=horse3;i++)
  48.            {
  49.            cout<<" ";   
  50.            }   
  51.          cout<<"☆"<<endl;
  52.         for(int i=0;i<=horse4;i++)
  53.            {
  54.            cout<<" ";   
  55.            }   
  56.          cout<<"◆"<<endl;
  57.      }
  58.    }
  59.     system("pause");
  60.     return 0;        
  61. }
複製代碼

TOP

返回列表