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

TOP

返回列表