返回列表 發帖
  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<<"「MY GO DID」賽馬場"<<endl;
  11.     cout<<"-------------------------------------------------------------------------| 終點"<<endl;
  12.     cout<<"as"<<endl;
  13.     cout<<"ad"<<endl;
  14.     cout<<"af"<<endl;
  15.     cout<<"ag"<<endl;
  16.     system("pause");
  17.     system("cls");
  18.    
  19.     while(a<=35 && b<=35 && c<=35 && d<=35)
  20.     {
  21.         r=rand()%4+1;
  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<<"as"<<endl;
  35.         for(int i=0; i<=b; i++)
  36.             cout<<"  ";
  37.         cout<<"ad"<<endl;
  38.         for(int i=0; i<=c; i++)
  39.             cout<<"  ";
  40.         cout<<"af"<<endl;
  41.         for(int i=0; i<=d; i++)
  42.             cout<<"  ";
  43.         cout<<"ag"<<endl;
  44.         system("cls");
  45.     }
  46.    
  47.     cout<<"結束"<<endl;
  48.     cout<<"-------------------------------------------------------------------------| 終點"<<endl;
  49.     for(int i=0; i<=a; i++)
  50.         cout<<"  ";   
  51.     cout<<"as"<<endl;
  52.     for(int i=0; i<=b; i++)
  53.         cout<<"  ";
  54.     cout<<"ad"<<endl;
  55.     for(int i=0; i<=c; i++)
  56.         cout<<"  ";
  57.     cout<<"af"<<endl;
  58.     for(int i=0; i<=d; i++)
  59.         cout<<"  ";
  60.     cout<<"ag"<<endl;
  61.    
  62.     system("pause");
  63.     goto re;
  64.     return 0;
  65. }
複製代碼
http://fs-old.mis.kuas.edu.tw/~s1102137106/music/

TOP

返回列表