- #include<iostream>
- #include<cstdlib>
- #include<time.h>
- using namespace std;
- int main()
- {
- int times=1;
- while(true)
- {
- int h1=0, h2=0, h3=0, h4=0, random=0;
- srand(time(NULL));
- cout<<"「好事成雙」賽馬場"<<"第"<<times <<"局"<<endl;
- cout<<"------------------------------------------------------------------------| 終點"<<endl;
- cout<<"ω"<<endl;
- cout<<"£"<<endl;
- cout<<"Θ"<<endl;
- cout<<"卍"<<endl;
- system("pause");
- system("cls");
-
- while(h1!=75 && h2!=75 && h3!=75 && h4!=75)
- {
- random=rand()%4;
- if(random==0) {
- h1++;
- }
- else if(random==1) {
- h2++;
- }
- else if(random==2) {
- h3++;
- }
- else if(random==3) {
- h4++;
- }
- cout<<"比賽進行中"<<endl;
- cout<<"------------------------------------------------------------------------| 終點"<<endl;
-
- for(int i=1; i<=h1; i++) {
- cout<<" ";
- }
- cout<<"ω"<<endl;
-
- for(int i=1; i<=h2; i++) {
- cout<<" ";
- }
- cout<<"£"<<endl;
-
- for(int i=1; i<=h3; i++) {
- cout<<" ";
- }
- cout<<"Θ"<<endl;
-
- for(int i=1; i<=h4; i++) {
- cout<<" ";
- }
- cout<<"卍"<<endl;
- system("cls");
- }
- if(h1==75)
- {
- cout<<"由ω先馳得點"<<endl;
- }
- else if(h2==75)
- {
- cout<<"由£先馳得點"<<endl;
- }
- else if(h3==75)
- {
- cout<<"由Θ先馳得點"<<endl;
- }
- else if(h4==75)
- {
- cout<<"由卍先馳得點"<<endl;
- }
- times++;
- }
- system("pause");
- return 0;
-
- }
複製代碼 |