- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main()
- {
- int r=0, n=1, b, buy, option;
- re:
- system("cls");
- srand(time(NULL));
- int s[]={0,0,0,0};
- string p[]={"◆","★","▲","●"};
- cout<<"「好事成雙」賽馬場 第"<<n<<"局"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<4; i++)
- {
- cout<<p[i]<<endl;
- }
- cout<<"餘額"<<b<<"元"<<endl;
- cout<<"(1)儲值(2)下注(3)離開 請選擇:";
- cin>>option;
- if(option==1)
- {
- cout<<"儲值:";
- cin>>buy;
- b=b+buy;
- goto re;
- }
- system("pause");
- system("cls");
- while(s[r]<=73)
- {
- r=rand()%4;
- s[r]++;
- cout<<"比賽進行中"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<4; i++)
- {
- for(int j=0; j<s[i]; j++)
- cout<<" ";
- cout<<p[i]<<endl;
- }
- _sleep(50);
- system("cls");
- }
- cout<<"比賽結束 "<<p[r]<<"贏"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<4; i++)
- {
-
- for(int j=0; j<s[i]; j++)
- cout<<" ";
- cout<<p[i]<<endl;
- }
- n++;
- system("pause");
- goto re;
- return 0;
- }
複製代碼 |