- #include <iostream>
- #include <cstdlib>
- #include <time.h>
- using namespace std;
- int main()
- {
- srand(time(NULL));
- int horse1,horse2,horse3,horse4=0;
- int random;
- while(true)
- {
- random=rand()%4;
- if(random==0)
- {
- horse1++;
- }
- else if(random==1)
- {
- horse2++;
- }
- else if(random==2)
- {
- horse3++;
- }
- else if(random==3)
- {
- horse4++;
- }
- cout<<"「好事成雙」賽馬場"<<endl;
- cout<<"---------------------------------------------------------------------------|終點"<<endl;
- cout<<"★"<<endl;
- cout<<"▲"<<endl;
- cout<<"☆"<<endl;
- cout<<"◆"<<endl;
- while(horse1!=75 || horse2!=75 || horse3!=75 || horse4!=75)
- {
- for(int i=0;i<=horse1;i++)
- {
- cout<<" ";
- }
- cout<<"★"<<endl;
- for(int i=0;i<=horse2;i++)
- {
- cout<<" ";
- }
- cout<<"▲"<<endl;
- for(int i=0;i<=horse3;i++)
- {
- cout<<" ";
- }
- cout<<"☆"<<endl;
- for(int i=0;i<=horse4;i++)
- {
- cout<<" ";
- }
- cout<<"◆"<<endl;
- }
- }
- system("pause");
- return 0;
- }
複製代碼 |