本帖最後由 黃茂勛 於 2016-10-15 11:42 編輯
- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- srand(time(NULL));
- re:
- system("cls");
- string n[]={"◆","★","▲","●"};
- int s[]={0,0,0,0};
- cout<<"「場賽馬賽場馬」賽馬場"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<4; i++)
- cout<<n[i]<<endl;
- system("pause");
- while(true)
- {
- int 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<<n[i]<<endl;
- }
- _sleep(10);
- system("cls");
- if(s[r]==76)
- break;
- }
- cout<<"比賽結束"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<4; i++)
- {
- for(int j=0; j<s[i]; j++)
- cout<<" ";
- cout<<n[i]<<endl;
- }
- system("pause");
- goto re;
- return 0;
- }
複製代碼 |