程序跳过我的while循环并结束.超级沮丧.我甚至在while循环之前将AnsCheck的值设置为false.没运气.该程序不执行While循环中的任何操作.这是相关的代码:
bool AnsCheck;
AnsCheck = false;
while (AnsCheck = false)
{
getline(cin, Ans1);
if (Ans1 != "T" || Ans1 != "F")
{
cout << "Please Enter T for true or F for False" << endl;
cout << "answer not T or not F" << endl; // debugging
}
else
{
AnsCheck = true;
cout << "changed bool to true" << endl;
}
}
Run Code Online (Sandbox Code Playgroud)