- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main(){
-
- re:
- system("cls");
- srand(time(NULL));
- string p[]={"◆","★","▲","●"};
- int s[]={0,0,0,0};
- int r=0;
- cout<<"歡迎光臨騙你錢賽馬場"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<4; i++)
- cout<<p[i]<<endl;
- system("pause");
- system("cls");
- while(s[r]<=73)
- {
- r=rand()%4; //0~3
- s[r]++;
- cout<<"比賽進行中"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<4; i++)
- {
- for(int j=0; j<s[i]; j++)
- cout<<" ";
- cout<<p[i]<<endl;
- }
- system("cls");
- }
- cout<<"比賽結束"<<endl;
- cout<<"-------------------------------------------------------------------------| 終點"<<endl;
- for(int i=0; i<4; i++)
- {
- for(int j=0; j<s[i]; j++)
- cout<<" ";
- cout<<p[i]<<endl;
- }
- system("pause");
- goto re;
- return 0;
- }
複製代碼 |