In Python I can do:
char_choice = input("What is your character choice? Please enter A, W or D.")
while char_choice.lower() not in ["a", "w", "d"]:
char_choice = input("You entered an incorrect character. Please try
again:")
Is there a way I can repeat line 2 in C++? I have tried the follow in many ways, yet it doesn't work, so I know I am doing something wrong:
char classificationCode;
cin >> classificationCode;
while (classificationCode != "b" || classificationCode != "B" || classificationCode != "d" || classificationCode != "D" || classificationCode != "w" || classificationCode != "W");
You're checking a char against a string, have you tried
classificationCode != 'b'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With