返回列表 發帖
  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.   srand(time(NULL));
  14.   while((a!=60)&&(b!=60)&&(c!=60)&&(d!=60))
  15.   {
  16.              r=rand()%4;
  17.              if(r==0)
  18.               a++;     
  19.              else if(r==1)
  20.               b++;   
  21.              else if(r==2)
  22.               c++;   
  23.              else
  24.               d++;   
  25.              cout<<"比賽進行中....";
  26.              cout<<endl<<"-----------------------------------------------------------|終點"<<endl;
  27.                for(int i=1;i<=a;i++)
  28.                cout<<" ";
  29.                cout<<"◥1◣"<<endl;     
  30.                for(int i=1;i<=b;i++)
  31.                cout<<" ";
  32.                cout<<"◥2◣"<<endl;
  33.                for(int i=1;i<=c;i++)
  34.                cout<<" ";
  35.                cout<<"◥3◣"<<endl;     
  36.                for(int i=1;i<=d;i++)
  37.                cout<<" ";
  38.                cout<<"◥4◣"<<endl;
  39.                system("cls");                             
  40.                                            }
  41.              cout<<"比賽結束!"<<endl;
  42.              cout<<endl<<"-----------------------------------------------------------|終點"<<endl;
  43.               for(int i=1;i<=a;i++)
  44.                cout<<" ";
  45.                cout<<"◥1◣"<<endl;     
  46.                for(int i=1;i<=b;i++)
  47.                cout<<" ";
  48.                cout<<"◥2◣"<<endl;
  49.                for(int i=1;i<=c;i++)
  50.                cout<<" ";
  51.                cout<<"◥3◣"<<endl;     
  52.                for(int i=1;i<=d;i++)
  53.                cout<<" ";
  54.                cout<<"◥4◣"<<endl;                                       
  55.   system("pause");
  56.   return 0;  
  57. }
複製代碼

TOP

返回列表