返回列表 發帖
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    int n=1;
  7.    re:      
  8.    int a=0,b=0,c=0,d=0,r;            
  9.    system("cls");   
  10.    cout<<"[gogo] 賽馬場 第"<<n<<"場"<<endl;
  11.    cout<<"--------------------------------------------------------------------------|終點"<<endl;
  12.    cout<<"1"<<endl;
  13.    cout<<"2"<<endl;
  14.    cout<<"3"<<endl;
  15.    cout<<"4"<<endl;
  16.    cout<<endl;
  17.    cout<<"1: AA"<<endl;
  18.    cout<<"2: AS"<<endl;
  19.    cout<<"3: AD"<<endl;
  20.    cout<<"4: AF"<<endl;
  21.    cout<<endl;
  22.     system("pause");
  23.     system("cls");   
  24.     while(a<=35 && c<=35 && b<=35 && d<=35)
  25.     {
  26.         r=rand()%4+1;
  27.         if(r==1)
  28.             a++;
  29.         else if(r==2)
  30.                b++;
  31.         else if(r==3)
  32.                c++;
  33.         else
  34.             d++;
  35.         cout<<"比賽進行中"<<endl;
  36.         cout<<"--------------------------------------------------------------------------|終點"<<endl;
  37.         for(int i=0;i<=a;i++)
  38.             cout<<"  ";
  39.         cout<<"1"<<endl;
  40.         for(int i=0;i<=b;i++)
  41.             cout<<"  ";
  42.         cout<<"2"<<endl;
  43.         for(int i=0;i<=c;i++)
  44.             cout<<"  ";
  45.         cout<<"3"<<endl;
  46.         for(int i=0;i<=d;i++)
  47.             cout<<"  ";
  48.         cout<<"4"<<endl;         
  49.         system("cls");              
  50.     }
  51.        if(a>=35)
  52.        {
  53.            cout<<"比賽結束  1贏了"<<endl;
  54.        }   
  55.        else if(b>=35)
  56.        {
  57.             cout<<"比賽結束  2贏了"<<endl;
  58.       }
  59.       else if(c>=35)
  60.       {
  61.             cout<<"比賽結束  3贏了"<<endl;
  62.       }
  63.       else
  64.       {
  65.            cout<<"比賽結束  4贏了"<<endl;
  66.       }                     
  67.      cout<<"--------------------------------------------------------------------------|終點"<<endl;
  68.      for(int i=0;i<=a;i++)
  69.          cout<<"  ";
  70.      cout<<"1"<<endl;
  71.      for(int i=0;i<=b;i++)
  72.          cout<<"  ";
  73.      cout<<"2"<<endl;
  74.      for(int i=0;i<=c;i++)
  75.          cout<<"  ";
  76.      cout<<"3"<<endl;
  77.      for(int i=0;i<=d;i++)
  78.          cout<<"  ";
  79.      cout<<"4"<<endl;
  80.    cout<<endl;
  81.    cout<<"#1: AA"<<endl;
  82.    cout<<"#2: AS"<<endl;
  83.    cout<<"#3: AD"<<endl;
  84.    cout<<"#4: AF"<<endl;
  85.    cout<<endl;
  86.    n++;
  87. system("pause");
  88. goto re;
  89. return 0;
  90. }
複製代碼
http://fs-old.mis.kuas.edu.tw/~s1102137106/music/

TOP

返回列表