- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int a=0,b=0,c=0,d=0,r=0;
- rel:
- cout<<"好事成雙賽馬場"<<endl;
- cout<<"------------------------------------------------------------------------| 終點"<<endl;
- cout<<"★"<<endl;
- cout<<"■"<<endl;
- cout<<"●"<<endl;
- cout<<"◆"<<endl;
- system("pause");
- system("cls");
- while(a!=75 && b!=75 && c!=75 && d!=75)
- {
- r=rand()%4;
- if(r==0)
- {
- a=a+1;
- }
- if(r==1)
- {
- b=b+1;
- }
- if(r==2)
- {
- c=c+1;
- }
- if(r==3)
- {
- d=d+1;
- }
- cout<<"比賽進行中"<<endl;
- cout<<"------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0;i<=a;i++)
- {
- cout<<" ";
- }
- cout<<"★"<<endl;
- for(int i=0;i<=b;i++)
- {
- cout<<" ";
- }
- cout<<"■"<<endl;
- for(int i=0;i<=c;i++)
- {
- cout<<" ";
- }
- cout<<"●"<<endl;
- for(int i=0;i<=d;i++)
- {
- cout<<" ";
- }
- cout<<"◆"<<endl;
- system("cls");
- }
- system("cls");
- goto rel;
- system("pause");
- return 0;
- }
複製代碼 |