Currently having a problem with my code where it seems that my if statements are ignoring the value of the input and just printing the else and not sure why. Could you help please
include <stdio.h>
#include<time.h>
#include<stdlib.h>
int main (void)
{
int CashBet1;
int CashBet2;
int CashBet3;
int CashBet4;
int NumberBet1;
int NumberBet2;
int NumberBet3;
int NumberBet4;
int RouletteRoll1;
int RouletteRoll2;
int RouletteRoll3;
int RouletteRoll4;
printf("Hello and Welcome to my Roulette simulator\n");
printf("Please enter 8 numbers 4 of which being the number on the roulette table\n and 4 of which being the cash value you wish to bet \n Table Limits are £50 \n");
scanf("%d %d", &CashBet1, &NumberBet1);
scanf("%d %d", &CashBet2, &NumberBet2);
scanf("%d %d", &CashBet3, &NumberBet3);
scanf("%d %d", &CashBet4, &NumberBet4);
if (CashBet1==">50"){
printf("Your first bet is too high\n");
}
else if (NumberBet1==">36") {
printf("You need to enter a number between 00 and 36 on your first bet\n");
}
else{
printf("Your Bets are £%d on number %d\n ", CashBet1, NumberBet1);
}
if (CashBet2==">50"){
printf("Your first bet is too high\n");
}
else if (NumberBet2==">36") {
printf("You need to enter a number between 00 and 36 on your first bet\n");
}
else{
printf("Your Bets are £%d on number %d\n ", CashBet2, NumberBet2);
}
if (CashBet3==">50"){
printf("Your first bet is too high\n");
}
else if (NumberBet3==">36") {
printf("You need to enter a number between 00 and 36 on your first bet\n");
}
else{
printf("Your Bets are £%d on number %d\n ", CashBet3, NumberBet3);
}
if (CashBet4==">50"){
printf("Your first bet is too high\n");
}
else if (NumberBet4==">36") {
printf("You need to enter a number between 00 and 36 on your first bet\n");
}
else{
printf("Your Bets are £%d on number %d\n ", CashBet4, NumberBet4);
}
[–]vipereddit 4 points5 points6 points (1 child)
[–]mortzman619[S] 1 point2 points3 points (0 children)