我正在尝试评估单个字符:
bool repeat = true;
while (repeat)
//code
char x;
cout << "Would you like to tansfer another file? Y/N ";
cin >> x;
if (x == 'y' || x == 'Y')
repeat = true;
if (x == 'n' || x == 'N')
repeat = false;
else
throw "Input error";
我不断收到输入错误作为我的控制台输出。任何想法为什么?我无法让 while 循环重复。