c++查找函数find()异常
//代码如下//
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name("the catche rin the rye");
string::type_size p=name.find("rye");
if(p=string::npos)
{
cout<<"the rye couldn't be find"<<endl;
}
else
cout<<"the rye find at p="<<p<<endl;
system("pause");
return 0;
}
//编译没错,但输出"the rye counldn't be find"//