- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int h1=0;
- int h2=0;
- int h3=0;
- int h4=0;
- int random=0;
- int round=1;
- srand(time(NULL));
- while(true)
- {
- cout<<"第"<<round<<"局"<<endl;
- cout<<"「好事成雙」賽馬場"<<endl;
- cout<<"|-------------------------------------------------------------------------|終點"<<endl;
- cout<<"◆"<<endl;
- cout<<"★"<<endl;
- cout<<"▲"<<endl;
- cout<<"●"<<endl;
- system("pause");
- while(h1!=75&&h2!=75&&h3!=75&&h4!=75)
- {
- random=rand()%4;
- if(random==0)
- {
- h1++;
- }
- if(random==1)
- {
- h2++;
- }
- if(random==2)
- {
- h3++;
- }
- if(random==3)
- {
- h4++;
- }
- cout<<"比賽進行中"<<endl;
- cout<<"|-------------------------------------------------------------------------|終點"<<endl;
- for(int i=0;i<=h1;i++)
- {
- cout<<" ";
- }
- cout<<"◆"<<endl;
- for(int i=0;i<=h2;i++)
- {
- cout<<" ";
- }
- cout<<"★"<<endl;
- for(int i=0;i<=h3;i++)
- {
- cout<<" ";
- }
- cout<<"▲"<<endl;
- for(int i=0;i<=h4;i++)
- {
- cout<<" ";
- }
- cout<<"●"<<endl;
- system("cls");
- }
- round++;
- system("cls");
- cout<<"比賽結束! 由";
- if(h1==75)
- {
- cout<<"◆搶先得馳"<<endl;
- }
- if(h2==75)
- {
- cout<<"★搶先得馳"<<endl;
- }
- if(h3==75)
- {
- cout<<"▲搶先得馳"<<endl;
- }
- if(h4==75)
- {
- cout<<"●搶先得馳"<<endl;
- }
- }
- system("pause");
- return 0;
- }
複製代碼 |