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