- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main(){
- srand(time(NULL));
- int r=0;
- int s[]={0,0,0,0};
- cout<<"「好事成雙」賽馬場"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- cout<<"◆"<<endl;
- cout<<"★"<<endl;
- cout<<"▲"<<endl;
- cout<<"●"<<endl;
- system("pause");
- while(s[r]<70){
- r=rand()%4;
- s[r]++;
- system("cls");
- cout<<"比賽進行中"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0;i<s[0];i++)
- cout<<" ";
- cout<<"◆"<<endl;
- for(int i=0;i<s[1];i++)
- cout<<" ";
- cout<<"★"<<endl;
- for(int i=0;i<s[2];i++)
- cout<<" ";
- cout<<"▲"<<endl;
- for(int i=0;i<s[3];i++)
- cout<<" ";
- cout<<"●"<<endl;
- _sleep (10);
-
- }
- system("pause");
- return 0;
- }
複製代碼 |