返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     srand(time(NULL));
  7.     re:
  8.     system("cls");
  9.     string n[]={"◆","★","▲","●"};
  10.     int s[]={0,0,0,0};
  11.     int r;
  12.     cout<<"「87878787878787878787878787」賽馬場"<<endl;
  13.     cout<<"-------------------------------------------------------------------------| 終點"<<endl;
  14.     for(int i=0; i<4; i++)
  15.         cout<<n[i]<<endl;
  16.     system("pause");
  17.     while(true)
  18.     {
  19.         cout<<"比賽進行中"<<endl;
  20.         cout<<"-------------------------------------------------------------------------| 終點"<<endl;
  21.         r=rand()%4;   
  22.         s[r]++;
  23.         for(int i=0; i<4; i++)
  24.         {
  25.             for(int j=0; j<s[i]; j++)
  26.                 cout<<" ";
  27.             cout<<n[i]<<endl;     
  28.         }
  29.         _sleep(10);
  30.         system("cls");
  31.         if(s[r]==76)
  32.             break;
  33.     }
  34.     cout<<"比賽結果"<<endl;
  35.     cout<<"-------------------------------------------------------------------------| 終點"<<endl;
  36.     for(int i=0; i<4; i++)
  37.     {
  38.         for(int j=0; j<s[i]; j++)
  39.             cout<<" ";
  40.         cout<<n[i]<<endl;     
  41.     }
  42.     system("pause");
  43.     goto re;
  44.     return 0;
  45. }
複製代碼

TOP

返回列表