- #include<iostream>
- #include<cstdlib>
- #include<time.h>
- using namespace std;
- int main()
- {
- int a1=0,a2=0,a3=0,a4=0,random=0;
- int times=1 ;
- srand(time(NULL));
- while(true)
- {
- cout<<"「好事成雙」賽馬場 " << "第 " <<times << "局 "<<endl;
- cout<<"-------------------------------------------------------------------------[終點"<<endl;
- cout<<"●"<<endl;
- cout<<"▼"<<endl;
- cout<<"■"<<endl;
- cout<<"★"<<endl;
- system("pause");
- while(a1!=75&&a2!=75&&a3!=75&&a4!=75)
- {
- random=rand()%4;
- if(random==0) {
- a1++;
- }
- else if(random==1)
- {
- a2++;
- }
- else if(random==2)
- {
- a3++;
- }
- else if(random==3)
- {
- a4++;
- }
- cout<<"「好事成雙」賽馬場"<<"第"<<times<<"局"<<endl;
- cout<<"-------------------------------------------------------------[終點"<<endl;
- for(int i=1; i<=a1; i++)
- {
- cout<<" ";
- }
- cout<<"◆"<<endl;
-
- for(int i=1; i<=a2; i++)
- {
- cout<<" ";
- }
- cout<<"★"<<endl;
-
- for(int i=1; i<=a3; i++) {
- cout<<" ";
- }
- cout<<"▲"<<endl;
-
- for(int i=1; i<=a4; i++) {
- cout<<" ";
- }
- cout<<"●"<<endl;
- system("cls");
- }
- times++ ;
- system("cls");
-
- if(a1==75)
- {
- cout<<"比賽結束 由:◆獲勝"<<endl;
- }
- else if(a2==75)
- {
- cout<<"比賽結束 由:★獲勝"<<endl;
- }
- else if(a3==75)
- {
- cout<<"比賽結束 由:▲獲勝"<<endl;
- }
- else if(a4==75)
- {
- cout<<"比賽結束 由:●獲勝"<<endl;
- }
- }
- system("pause");
- return 0;
-
- }
複製代碼 |