- #include<bits/stdc++.h>
- using namespace std;
- int n=0;
- int main()
- {
- re:
- n++;
- system("cls");
- int s[]= {0,0,0,0};
- string p[]= {"◆","★","▲","●"};
- int r;
- srand(time(NULL));
- cout<<"「好事成雙」賽馬場"<<"第"<<n<<"局"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<4; i++)
- {
- cout<<p[i]<<endl;
- }
- system("pause");
- system("cls");
- while(s[r]<=71)
- {
- r=rand()%4;
- s[r]++;
- cout<<"比賽進行中"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<4; i++)
- {
- for(int j=0; j<s[i]; j++)
- {
- cout<<" ";
- }
- cout<<p[i]<<endl;
- }
- _sleep(25);
- system("cls");
- }
- cout<<"比賽結束,由"<<p[r]<<"先馳得點"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<4; i++)
- {
- for(int j=0; j<s[i]; j++)
- cout<<" ";
- cout<<p[i]<<endl;
- }
- system("pause");
- system("cls");
- goto re;
- return 0;
- }
複製代碼 |