- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main()
- {
- cout<<"賽馬場"<<endl;
- cout<<"-----------------------------------------------------------------終點"<<endl;
- cout<<"▲"<<endl;
- cout<<"●"<<endl;
- cout<<"?"<<endl;
- cout<<"★"<<endl;
- system("pause");
- system("cls");
- srand(time(NULL));
-
-
- int a=0,b=0,c=0,d=0,r=0,;
- string words ="賽馬進行中";
- while(a<=70 && b<=70 && c<=70 && d<=70)
- {
- cout<<words<<endl;
- cout<<"------------------------------------------------------------------------| 終點"<<endl;
- r=rand()%4+1;
- switch(r)
- {
- case 1:
- a++;
- break;
- case 2:
- b++;
- break;
- case 3:
- c++;
- break;
- case 4:
- d++;
- break;
- }
- 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;
-
- if(a==70 || b==70 || c==70 || d==70)
- {
- words = "賽馬完成";
- }
- if(a==71 || b==71 || c==71 || d==71)
- {
- }else{
- system("cls");
- }
-
- }
-
- system("pause");
- return 0;
- }
複製代碼 |