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

TOP

返回列表