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

TOP

返回列表