【发布时间】:2015-03-28 21:41:20
【问题描述】:
在 Python 中我可以做到:
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:")
有没有办法可以在 C++ 中重复第 2 行?我已经尝试了很多方法,但它不起作用,所以我知道我做错了什么:
char classificationCode;
cin >> classificationCode;
while (classificationCode != "b" || classificationCode != "B" || classificationCode != "d" || classificationCode != "D" || classificationCode != "w" || classificationCode != "W");
【问题讨论】:
标签: python c++ validation loops conditional-statements