- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- re:
- system("cls");
- int a=0,b=0,c=0,d=0,r;
- srand(time(NULL));
- cout<<"「好事成雙」賽馬場"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- cout<<"◆"<<endl;
- cout<<"★"<<endl;
- cout<<"▲"<<endl;
- cout<<"●"<<endl;
- system("pause");
- system("cls");
-
- while(a<=73 && b<=73 && c<=73 && d<=73)
- {
- r=rand()%4+1; // 1~4
- if(r==1)
- a++;
- else if(r==2)
- b++;
- else if(r==3)
- c++;
- else
- d++;
- cout<<"比賽進行中"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<=a; i++)
- cout<<" ";
- cout<<"1111"<<endl;
- for(int i=0; i<=b; i++)
- cout<<" ";
- cout<<"111"<<endl;
- for(int i=0; i<=c; i++)
- cout<<" ";
- cout<<"11"<<endl;
- for(int i=0; i<=d; i++)
- cout<<" ";
- cout<<"1"<<endl;
- system("cls");
- }
-
- cout<<"賽結束"<<endl;
- cout<<"-------------------------------------------------------------------------| 終"<<endl;
- for(int i=0; i<=a; i++)
- cout<<" ";
- cout<<"1111"<<endl;
- for(int i=0; i<=b; i++)
- cout<<" ";
- cout<<"111"<<endl;
- for(int i=0; i<=c; i++)
- cout<<" ";
- cout<<"11"<<endl;
- for(int i=0; i<=d; i++)
- cout<<" ";
- cout<<"1"<<endl;
-
- system("pause");
- goto re;
- return 0;
- }
複製代碼 |