返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int a=0 ,b=0, c=0, d=0,r;
  7.     cout<<"*準備輸光吧賽馬場*"<<endl;
  8.     cout<<"----------------------------------------------------------------------------|終點|"<<endl;
  9.     cout<<"◢1◤"<<endl;
  10.     cout<<"◢2◤"<<endl;
  11.     cout<<"◢3◤"<<endl;
  12.     cout<<"◢4◤"<<endl;
  13.     system("pause");
  14.     system("cls");
  15.     srand(time(NULL));
  16.     while((a!=70) && (b!=70) && (c!=70) && (d!=70))
  17.     {
  18.         r=rand()%4;
  19.         if(r==0)              
  20.         a++;
  21.         else if(r==1)              
  22.         b++;
  23.         else if(r==2)              
  24.         c++;
  25.         else if(r==3)              
  26.         d++;
  27.     cout<<"比賽進行中";
  28.     cout<<endl<<"---------------------------------------------------------------------|終點|"<<endl;
  29.     for(int i=1;i<=a;i++)
  30.         cout<<" ";
  31.     cout<<"◢1◤"<<endl;
  32.     for(int i=1;i<=b;i++)
  33.         cout<<" ";
  34.     cout<<"◢2◤"<<endl;
  35.     for(int i=1;i<=c;i++)
  36.         cout<<" ";
  37.     cout<<"◢3◤"<<endl;
  38.     for(int i=1;i<=d;i++)
  39.         cout<<" ";
  40.     cout<<"◢4◤"<<endl;
  41.     system("cls");         
  42.     }
  43.     cout<<"比賽結束";
  44.     cout<<endl<<"---------------------------------------------------------------------|終點|"<<endl;
  45.     for(int i=1;i<=a;i++)
  46.         cout<<" ";
  47.     cout<<"◢1◤"<<endl;
  48.     for(int i=1;i<=b;i++)
  49.         cout<<" ";
  50.     cout<<"◢2◤"<<endl;
  51.     for(int i=1;i<=c;i++)
  52.         cout<<" ";
  53.     cout<<"◢3◤"<<endl;
  54.     for(int i=1;i<=d;i++)
  55.         cout<<" ";
  56.     cout<<"◢4◤"<<endl;
  57.            
  58.          
  59.    
  60.    
  61.     system("pause");   
  62.     return 0;
  63. }
複製代碼

TOP

返回列表