#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,mm=0,lol=0,buy=0,bet=0,play=0;
while(lol == 0 or lol ==1)
{
srand(time(NULL));
system("cls");
cout<<"尬賽馬場 "<< "第" <<tim << "局"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
system("pause");
system("cls");
cout<<"餘額: "<<mm<<"元"<<endl;
cout<<"(1)買入 (2)下注 (3)離開 請選擇: ";
cin>>lol;
if(lol==1)
{
cout<<"買入: ";
cin>>buy;
mm+=buy;
}
else if(lol == 2)
{
cout<<"下注: ";
cin>>bet;
cout<<endl<<"(1)◆ (2)★ (3)▲ (4)● 請選擇: ";
cin>>play;
cout<<"比賽即將開始..."<<endl<<endl;
}
else if(lol == 3)
{
break;
}
system("pause");
system("cls");
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;
} |