T
tigrfire
I've written the following function:
void getWager()
{
int wager;
int balance;
printf("Enter wager: ");
scanf("%d", &wager);
if (wager > balance || wager <= 0)
{
printf("Your wager must not exceed your current balance.\n");
printf("Enter a new wager: ");
scanf("%d", &wager);
getWager();
return;
}
}
I would like this function to output as follows:
Enter wager: 5000
Your wager must not exceed your current balance.
Enter a new wager: 50
Instead though, since I use a recursive getWager() at the end of my
getWager function, it displays as following:
Enter wager: 5000
Your wager must not exceed your current balance.
Enter a new wager: 50
Enter wager:
I would like on how to fix this, though without using anything more
complicated than what I have already listed, my knowledge is pretty
limited. Thanks.
void getWager()
{
int wager;
int balance;
printf("Enter wager: ");
scanf("%d", &wager);
if (wager > balance || wager <= 0)
{
printf("Your wager must not exceed your current balance.\n");
printf("Enter a new wager: ");
scanf("%d", &wager);
getWager();
return;
}
}
I would like this function to output as follows:
Enter wager: 5000
Your wager must not exceed your current balance.
Enter a new wager: 50
Instead though, since I use a recursive getWager() at the end of my
getWager function, it displays as following:
Enter wager: 5000
Your wager must not exceed your current balance.
Enter a new wager: 50
Enter wager:
I would like on how to fix this, though without using anything more
complicated than what I have already listed, my knowledge is pretty
limited. Thanks.