#include "iostream"
#include "string"
using namespace std;
int main()
{
string str1("abcdefghijk");
string str2("cde");
int loc;
loc=str1.find("e"); //在str1中寻找e
if(loc!=-1)
cout<<"find e in "<<loc<<endl;
else
cout<<"cannot find e"<<endl;
loc=str1.find("e",5); //在str1中从第6个字符开始寻找e
if(loc!=-1)
cout<<"find e in "<<loc<<endl;
else
cout<<"cannot find e"<<endl;
loc=str1.find(str2); //在str1中寻找str2串
if(loc!=-1)
cout<<"find str2 in "<<loc<<endl;
else
cout<<"cannot find str2"<<endl;
loc=str1.find(str2,3); //在str1中从第4个字符开始寻找str2串
if(loc!=-1)
cout<<"find str2 in "<<loc<<endl;
else
cout<<"cannot find str2"<<endl;
return 0;
}