- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main()
- {
- int f=0;
- int d=1;
- re:
- system("cls");
- int a[]={0,0,0,0};
- string c[]={"◆","★","▲","●"};
- srand(time(NULL));
- int b=0;
- cout<<"賽馬場--第"<<d<<"場"<<endl;
- cout<<"-------------------------------------------------------------------------|終點線"<<endl;
- for(int i=0;i<=3;i++)
- {
- cout<<c[i]<<endl;
- }
- cout<<endl<<"可用餘額:"<<f<<endl<<endl;
- cout<<"(1)儲值 (2)下注 (3)離開 ";
- int g;
- cin>>g;
- if(g==1)
- {
- cout<<"你要儲值多少錢?";
- int h;
- cin>>h;
- f=f+h;
- goto re;
- }
- system("pause");
- system("cls");
- while(true)
- {
- b=rand()%4;
- a[b]++;
- cout<<"比賽進行中"<<endl;
- cout<<"-------------------------------------------------------------------------|終點線"<<endl;
-
- for(int i=0;i<4;i++)
- {
- for(int j=0;j<=a[i];j++)
- {
- cout<<" ";
- }
- cout<<c[i]<<endl;
- }
- if(a[b]==73)
- {
- break;
- }
- _sleep(50);
- system("cls");
- }
- cout<<"!比賽結束 由"<<c[b]<<"勝利"<<endl;
- cout<<"-------------------------------------------------------------------------|終點線"<<endl;
- for(int i=0;i<4;i++)
- {
- for(int j=0;j<=a[i];j++)
- {
- cout<<" ";
- }
- cout<c[i]<<endl;
- }
-
- system("pause");
- d++;
- goto re;
- return 0;
- }
複製代碼 |