- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- re:
- int a=0,b=0,c=0,d=0,r;
- cout<<"賽~馬~"<<endl;
- cout<<"|起點|--------------------------------------------------------------|終點|"<<endl;
- cout<<"★"<<endl;
- cout<<"㊣"<<endl;
- cout<<"▽"<<endl;
- cout<<"◆"<<endl;
- system("pause");
- system("cls");
- srand(time(NULL));
- while(a!=70 && b!=70 && c!=70 && d!=70)
- {
- cout<<"~賽馬進行中~"<<endl;
- cout<<"|起點|--------------------------------------------------------------|終點|"<<endl;
- r=rand()%4;
- if(r==0)
- {
- a++;
- }
- if(r==1)
- {
- b++;
- }
- if(r==2)
- {
- c++;
- }
- if(r==3)
- {
- d++;
- }
- 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");
- }
- 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("pause");
- system("cls");
- goto re;
- system("pause");
- return 0;
- }
複製代碼 |