返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<time.h>
  4. using namespace std;
  5. int main()
  6. {
  7. int times=1;
  8. int money=0;
  9. int select=0;
  10. int tt=0;
  11. while(true)
  12. {
  13.   int horse1=0, horse2=0, horse3=0, horse4=0, random=0;
  14.   srand(time(NULL));
  15.   cout<<"可用餘額:"<<money<<"元"<<endl;
  16.   cout<<"(1)儲值(2)下注(3)離開";
  17.   cin>>select;
  18.   if(select==1)
  19.   {
  20.   cout<<"請輸入金額:";
  21.   cin>>tt;
  22.   money=tt;
  23.   }
  24.   if(select==2)
  25.   {

  26.   }
  27.   if(select==3)
  28.   {

  29.   }
  30.   cout<<"「好事成雙」賽馬場" << "第 " <<times << "局 "<<endl;
  31.   cout<<"------------------------------------------------------------------------| 終點"<<endl;
  32.   cout<<"◆"<<endl;
  33.   cout<<"★"<<endl;
  34.   cout<<"▲"<<endl;
  35.   cout<<"●"<<endl;
  36.   system("pause");
  37.   system("cls");
  38.   while(horse1!=75 && horse2!=75 && horse3!=75 && horse4!=75)
  39.   {
  40.    random=rand()%4;
  41.    if(random==0)
  42.    {
  43.     horse1++;
  44.    }
  45.    else if(random==1)
  46.    {
  47.     horse2++;
  48.    }
  49.    else if(random==2)
  50.    {
  51.     horse3++;
  52.    }
  53.    else if(random==3)
  54.    {
  55.     horse4++;
  56.    }
  57.    cout<<"比賽進行中"<<endl;
  58.    cout<<"------------------------------------------------------------------------| 終點"<<endl;
  59.    for(int i=1; i<=horse1; i++)
  60.    {
  61.     cout<<" ";
  62.    }
  63.    cout<<"◆"<<endl;
  64.    for(int i=1; i<=horse2; i++)
  65.    {
  66.     cout<<" ";
  67.    }
  68.    cout<<"★"<<endl;
  69.    for(int i=1; i<=horse3; i++)
  70.    {
  71.     cout<<" ";
  72.    }
  73.    cout<<"▲"<<endl;
  74.    for(int i=1; i<=horse4; i++)
  75.    {
  76.     cout<<" ";
  77.    }
  78.    cout<<"●"<<endl;
  79.    system("cls");      
  80.   }
  81.     if(horse1==75)
  82.     {
  83.      cout<<"比賽結束,由◆先馳得點"<<endl;
  84.     }
  85.     else if(horse2==75)
  86.     {
  87.      cout<<"比賽結束,由★先馳得點"<<endl;
  88.     }
  89.     else if(horse3==75)
  90.     {
  91.      cout<<"比賽結束,由▲先馳得點"<<endl;
  92.     }
  93.     else if(horse4==75)
  94.     {
  95.      cout<<"比賽結束,由●先馳得點"<<endl;
  96.     }
  97.     times++;
  98. }
  99.     system("pause");
  100.     return 0;
  101. }
複製代碼

TOP

返回列表