#include <iostream>
using namespace std;
int main(){
cout << endl;
cout << "Welcome to the wonderful world of a spy" << endl;
cout << "Today we are to decode some information that has been provided." <<endl;
string response;
cout << "Are you ready?" << endl;
cin >> response;
if (response == "yes", "y", "Yes", "Y"){
cout << "Alright, let's go!!!" << endl;
}
else {
cout << "Well, too bad. We are going to do it anyways." << endl;
}
}
Exact Code这是我的代码到目前为止。我不能说“好吧,我们走吧!!!我做错了什么?问题和如果语句包含一个字符串在C++
让我们从一个实际的代码片段开始,而不是一个截图。代码进入你的问题。 – Thebluefish
请不要试图猜测语法。这个'if'语句的结果是''Y''的评估,它总是'true'(剩下的被丢弃,它们没有副作用)。请获得[好书](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) – Rakete1111