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

TOP

返回列表