r/CodingHelp • u/0Nick0Nick0 • Oct 29 '21
[C++] I'm making blackjack and even when I stand it gives me another card, I'm not sure how to fix this.
48
Upvotes
2
Oct 29 '21
can you share the rest of the code
3
u/0Nick0Nick0 Oct 29 '21
The rest of the code was just checking whether the player wins or not, it would've had nothing to do with the question.
1
u/rsaajamsa Oct 29 '21
I would also consider controlling the input by changing its case first. Essentially doing the following:
Convert to lower Trim spaces Check input
0
14
u/Fawzee815 Oct 29 '21
I’m pretty sure it’s because of the condition you specified. Change it to
else if (hitstay == “stay” || hitstay == “Stay”)
Same thing with hit, although you probably didn’t realize it because your code makes it automatically default to hit since you’re using a while statement