Originally Posted by
samlarenskoog
Hello guys i am back again. This time I am in need of some help with this game I am creating using functions again.
Your int horse is uninitialized. In fact nowhere does it give any input on what horse you are going to bet.
change this part:
Code:
int main()
{
int z;
cout << "Welcome, bet on your horse";
int menu(void);
int rand(int z);
to this:
Code:
int main()
{
int z;
cout << "Welcome, bet on your horse: ";
cin >> horse;
cout << "You chose horse " << horse << endl;
int rand(int z);
and remove this:
Code:
int menu(void)
{
switch (horse) {
case 1:
cout << "You chose horse 1\n";
int horse = 1;
break;
case 2:
cout << "You chose horse 2\n";
int horse = 2;
break;
case 3:
cout << "You chose horse 3\n";
int horse = 3;
break;
}
}
I think you'll be on the right track then.
- - - Updated - - -
Now obviously you'll still need to add some securities like that you can only choose number 1 to 3 for example.