- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main()
- {
- system("cls");
- srand(time(NULL));
- int x[]={0,0,0,0};
- string p[]={"◆","★","▲","●"};
- int y=0;
- cout<<"「好事不成雙 見好就收」賽馬場"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<4; i++)
- cout<<p[i]<<endl;
- system("pause");
- system("cls");
- while(x[y]<=73)
- {
- y=rand()%4;
- x[y]++;
- cout<<"比賽進行中"<<endl;
- cout<<"----------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<4; i++)
- {
- for(int j=0; j<x[i]; j++)
- cout<<" ";
- cout<<p[i]<<endl;
- }
- _sleep(25);
- system("cls");
- }
- cout<<"比賽結束"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<4; i++)
- {
-
- for(int j=0; j<x[i]; j++)
- cout<<" ";
- cout<<p[i]<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |