- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main()
- {
- int x=1,blance=0,option=0,buyin=0;
- string name[4]={"◆","★","▲","●"};
- re:
- system("cls");
- cout<<"「好事成雙」賽馬場"<<"第"<<x<<"局"<<endl;
- cout<<"------------------------------------------------------------------------|終點"<<endl;
- cout<<"◆"<<endl;
- cout<<"★"<<endl;
- cout<<"▲"<<endl;
- cout<<"●"<<endl;
- cout<<endl;
- cout<<"可用餘額:"<<blance<<"元"<<endl;
- cout<<"(1)買入(2)下注(3)離開 請選擇:";
- cin>>option;
- if(option==1)
- {
- cout<<"買入:";
- cin>>buyin;
- blance+=buyin;
- goto re;
- }
- system("pause");
- system("cls");
- srand(time(NULL));
- int a=0,b=0,c=0,d=0,r,z=0;
- string words ="賽馬進行中";
- while(a<=70 && b<=70 && c<=70 && d<=70)
- {
- cout<<words<<"第"<<x<<"局"<<endl;
- cout<<"------------------------------------------------------------------------|終點"<<endl;
- r=rand()%4+1;
-
- switch(r)
- {
- case 1:
- a++;
- break;
- case 2:
- b++;
- break;
- case 3:
- c++;
- break;
- case 4:
- d++;
- break;
- }
- for(int i=0;i<=a;i++)
- cout<<" ";
- cout<<"◆"<<endl;
- for(int i=0;i<=b;i++)
- cout<<" ";
- cout<<"★"<<endl;
- for(int i=0;i<=c;i++)
- cout<<" ";
- cout<<"▲"<<endl;
- for(int i=0;i<=d;i++)
- cout<<" ";
- cout<<"●"<<endl;
- if(a==70 || b==70 || c==70 || d==70)
- {
-
- if(a==70)
- z=0;
- if(b==70)
- z=1;
- if(c==70)
- z=2;
- if(d==70)
- z=3;
- words = "賽馬完成,由"+name[z]+"先馳得點";
- }
- if( a==71 || b==71 || c==71 || d==71)
- {
- }else{
- system("cls");
-
- }
- }
-
- x++;
-
- goto re;
- system("pause");
- return 0;
- }
複製代碼 |