#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
int main()
{
string str="I am a good programmer:: >> ";
int loc;
cout << "find this string >> "<< str.find("programmer")<< endl;
cout << "find this string >> "<< str.rfind("programmer")<< endl;
loc=str.find_first_of("mo");
cout << "find First character >> "<< str[loc]<< endl;
cout << "Locaton is found >> "<< loc << endl;
loc=str.find_last_of("pgr");
cout << "find the last character >> "<< str[loc]<< endl;
cout << "Locaton is found >> "<< loc << endl;
getch();
}
#include<conio.h>
#include<string>
using namespace std;
int main()
{
string str="I am a good programmer:: >> ";
int loc;
cout << "find this string >> "<< str.find("programmer")<< endl;
cout << "find this string >> "<< str.rfind("programmer")<< endl;
loc=str.find_first_of("mo");
cout << "find First character >> "<< str[loc]<< endl;
cout << "Locaton is found >> "<< loc << endl;
loc=str.find_last_of("pgr");
cout << "find the last character >> "<< str[loc]<< endl;
cout << "Locaton is found >> "<< loc << endl;
getch();
}