- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int s[]={0,0,0,0};
- srand(time(NULL));
-
-
- cout<<"Racehorse thing"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- cout<<"◆"<<endl<<"★"<<endl<<"▲"<<endl<<"●"<<endl;
- system("pause");
- while(1)
- {
- system("cls");
- int r=rand()%4;
- s[r]++;
- cout<<"Race in progress..."<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0;i<=s[0];i++)
- cout<<" ";
- cout<<"◆"<<endl;
- for(int i=0;i<=s[1];i++)
- cout<<" ";
- cout<<"★"<<endl;
- for(int i=0;i<=s[2];i++)
- cout<<" ";
- cout<<"▲"<<endl;
- for(int i=0;i<=s[3];i++)
- cout<<" ";
- cout<<"●"<<endl;
- if(s[r]==73)
- break;
- _sleep(10);
- }
- system("cls");
- cout<<"Race ended!"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0;i<=s[0];i++)
- cout<<" ";
- cout<<"◆"<<endl;
- for(int i=0;i<=s[1];i++)
- cout<<" ";
- cout<<"★"<<endl;
- for(int i=0;i<=s[2];i++)
- cout<<" ";
- cout<<"▲"<<endl;
- for(int i=0;i<=s[3];i++)
- cout<<" ";
- cout<<"●"<<endl;
- system("pause");
- return 0;
- }
複製代碼 |