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