最近在代码中, 看到类似这样一段代码:

#include <iostream>
#include <string>
using namespace std;

int main()
{
	string s = "abc";
	if(s.find("x"))
	{
		cout << "yes" << endl;	
	}
	else
	{
		cout << "no" << endl;	
	}

    return 0;  
}
      结果是: yes


      刚好与程序的本意违背, 大家思考一下, 为什么? 要注意什么?






本文转载:CSDN博客