0

How come this loop always says "Pick 's' or 'h' try again" when I pick 's' or 'h'? I feel like the logic is correct I just don't know it says that no matter what I put even if it is 's' or h'.

do {
    printf("Do you want to (H)it or (S)tand?");
    scanf("%ch", &decision);
    tolower(decision);
    if (decision != 'h' && decision != 's') {
        printf("Pick 's' or 'h'. Try again.\n");
        printf("Do you want to (H)it or (S)tand?");
        scanf("%ch", &decision);
        tolower(decision);
    }
    if (decision == 'h') {
        playershand = add_card_to_hand(&playershand, card);
        printf("Your cards:\n");
        print_hand(playershand);
        playerscore = blackjack_value(playershand);
        printf("Score = %d\n", playerscore);
    }
    if (decision == 's') {
        add_card_to_hand(&dealershand, card);
        print_hand(dealershand);
    }
Yunnosch
  • 26,130
  • 9
  • 42
  • 54

0 Answers0