【发布时间】:2023-03-30 12:38:01
【问题描述】:
if(response=='y'){
cout << "great. file saved, please send the file to me and you'll receive the package information and status.";
}
else if(response=='n'){
cout << "exiting. please do it again correctly, thanks!";
}
上面的代码给了我以下编译错误:
错误:'operator==' 不匹配(操作数类型是 'std::string {aka std::basic_string}' 和 'char')|
我不知道是什么问题。
有人可以就此提供一些建议吗?谢谢!
【问题讨论】:
-
使用
"y"而不是'y'。
标签: c++