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

TOP

返回列表