- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main()
- {
- while(true)
- {
- system("cls");
- int s[]={0,0,0,0};
- srand(time(NULL));
- cout<<"「好事成雙」賽馬場"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- cout<<"◆"<<endl;
- cout<<"★"<<endl;
- cout<<"▲"<<endl;
- cout<<"●"<<endl;
-
- while(true)
- {
- system("cls");
- int r=rand()%4;
- s[r]++;
- 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;
- if(s[r]==72)
- break;
- _sleep(1);
- }
- system("pause");
- }
- system("pause");
- return 0;
- }
複製代碼 |