#include <iostream>
#include <ctime>
int race (int a, int b, int c);
void race();
int hold (int b, int c);
void init ();
int money = 200;
int main ()
{
using std::cout;
using std::cin;
int act;
cout<< "W e l c o m e\n" << money << " piece(s) at hand\n";
do
{
cout<< "The Race\n""1) Bet on Ⅰ\n""2) Bet on Ⅱ\n""3) Bet on Ⅲ\n""4) Spectate\n""0) Depart\n""\n[Enter]: ";
cin>> act;
} while ( act < 0 || act > 4);
hold (act, bet);
race (money, act, bet);
return 0;
}
int hold (int b, int c)
{
using std::cout;
using std::cin;
cout<< "Snail " << b << " it is\n""Now, what is your bet?\n[Enter]: ";
cin>> c;
return c;
}
int race (int a, int b, int c)
{
using std::cout;
using std::rand;
init ();
int outcome = rand () % 3;
cout<< "-Klutch-\nThey're full of energy, today!\n\n"
<< outcome << " is our winner of today!\n";
if (outcome == b)
{
cout<< "Here is your profit\n";
return ::money += c;
}
else
{
cout<< "Oh..";
return ::money -= c;
}
}
void race ()
{
race (0,0,0);
}
void init ()
{
using std::srand;
using std::time;
srand (unsignedint(time(0))); //unsigned不要on srand
}
int race (int a, int b, int c);
void race();
void init ();
int money = 200;
int act;
int main ()
{
using std::cout;
using std::cin;
int bet = 0;
cout<< "W e l c o m e\n" << money << " piece(s) at hand\n";
do
{
cout<< "The Race\n"
"1) Bet on Ⅰ\n"
"2) Bet on Ⅱ\n"
"3) Bet on Ⅲ\n"
"4) Spectate\n"
"0) Leave\n"
"\n[Enter]: ";
cin>> act;
} while ( act < 0 || act > 4);
if (act == 4)
void hold();
if (act == 0)
{cout<< "\nCome join us again.\n"; return 0;}
if (act == 4)
return 0;
cout<< "Snail " << act << " it is\n"
"Now, what is your bet?\n[Enter]: ";
cin>> bet;