#include<iostream>
#include<cstdlib>
#include<time.h>
using namespace std;
int main()
{
int tim=1;
while(true)
{
int gay1=0, gay2=0, gay3=0, gay4=0, rad=0;
srand(time(NULL));
system("cls");
cout<<"尬賽馬場 "<< "第" <<tim << "局"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
system("pause");
system("cls");
while(gay1!=75 && gay2!=75 && gay3!=75 && gay4!=75)
{
rad=rand()%4;
if(rad==0)
{ gay1++;}
else if(rad==1)
{ gay2++;}
else if(rad==2)
{ gay3++;}
else if(rad==3)
{ gay4++; }
cout<<"比賽進行中"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
for(int i=1; i<=gay1; i++)
{ cout<<" ";}
cout<<"◆"<<endl;
for(int i=1; i<=gay2; i++)
{ cout<<" ";}
cout<<"★"<<endl;
for(int i=1; i<=gay3; i++)
{ cout<<" ";}
cout<<"▲"<<endl;
for(int i=1; i<=gay4; i++)
{ cout<<" ";}
cout<<"●"<<endl;
system("cls");
}
tim++;
system("cls");
cout<<"比賽結束! 由 ";
if(gay1 == 75) {
cout<< "◆" << "先到終點" << endl;
}
else if (gay2 == 75) {
cout<< "★" << "先到終點" << endl;
}
else if (gay3 == 75) {
cout<< "▲" << "先到終點" << endl;
}
else if (gay4 == 75) {
cout<< "●" << "先到終點" << endl;
}
cout<<"------------------------------------------------------------------------| 終點"<<endl;
for(int i=1; i<=gay1; i++)
{
cout<<" ";
}
cout<<"◆"<<endl;
for(int i=1; i<=gay2; i++)
{
cout<<" ";
}
cout<<"★"<<endl;
for(int i=1; i<=gay3; i++)
{
cout<<" ";
}
cout<<"▲"<<endl;
for(int i=1; i<=gay4; i++)
{
cout<<" ";
}
cout<<"●"<<endl;
system("pause");
}
system("pause");
return 0;
} |