每当我输入数字1时,它就不断地遍历print_menu();得双曲余切值.
如果choice是== to 1,我希望while循环会继续执行if语句,但它没有。它一直打印菜单。事实上,如果我输入任何数字,它都会打印菜单。
while (run_game==TRUE) {
print_menu();
scanf("%d", &choice);
choice = choice1;
if (choice1 == 1) {
while (hands<10);
shuffle(card_deck);
deal(card_deck, face, suit);
print_hand(face, suit, p1_hand);
printf("You have these cards in your hand:\n");
p1_score = check_hand(p1_hand);
p2_score = check_hand(p2_hand);
printf("Player one has :%d points", p1_score);
printf("Redraw card?\n 1.Yes, 2. No");
scanf("%d", &ans);
if (ans == 1) {
while (ans > 3) {
print_hand(face, suit, p1_hand);
}
}
}
}
}
1条答案
按热度按时间qnyhuwrf1#
你是想把
scanf
变成choice1
吗?如果不是,那么下一行将覆盖
choice
,并且它将始终是choice1
开始时的内容。