- #include<bits\stdc++.h>
- #include<cstdlib>
- using namespace std;
- int n=1;
- int main()
- {
- re:
- system("cls");
- int r;
- srand(time(NULL));
- int s[]={0,0,0,0};
- string a[]={"★","◆","●","▲"};
- cout<<"「好事成雙」賽馬場 第"<<n<<"局"<<endl;
- cout<<"---------------| 終點"<<endl;
- for(int i=0;i<4;i++)
- {
- cout<<a[i]<<endl;
- }
- system("pause");
- system("cls");
- while(s[r]<=15)
- {
- 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<<a[i]<<endl;
- }
- _sleep(50);
- system("cls");
- }
- system("cls");
- cout<<"比賽結束"<<endl;
- cout<<"---------------| 終點 由 "<<a[r]<<" 先馳得點!"<<endl;
- for(int i=0;i<4;i++)
- {
- for(int j=0;j<s[i];j++)
- cout<<" ";
- cout<<a[i]<<endl;
- }
- system("pause");
- n++;
- goto re;
- return 0;
- }
複製代碼 |