为什么这个循环总是说"选择'或者' h'再试一次"当我选择'或者' h'?我觉得逻辑是正确的我只是不知道它说无论我把它放在哪里,即使它是' s'或者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);
}