#include #include using namespace std; int main() { string hand = "Have a nice day"; string nice = "nice"; string Nice = "Nice"; cout << hand.find(nice) << endl; cout << hand.find("nice") << endl; cout << hand.find(Nice) << endl; cout << nice << " is " << (hand.find(nice) == string::npos ? "not " : "") << "present" << endl; cout << Nice << " is " << (hand.find(Nice) == string::npos ? "not " : "") << "present" << endl << endl; // Find the first 'a' cout << hand.find('a') << endl; // Find the second 'a' cout << hand.find('a',hand.find('a')+1) << endl; // Find the third 'a' cout << hand.find('a',hand.find('a',hand.find('a')+1)+1) << endl; // Find the last 'a' cout << hand.rfind('a') << endl << endl; cout << hand.find_first_of(nice) << endl; cout << hand.find_first_of("abcde") << endl; cout << hand.find_first_of('v') << endl; cout << hand.find_first_of('v',3) << endl << endl; cout << hand.find_last_of("abcde") << endl; cout << hand.find_first_not_of("abcdefghijklmnopqrstuvwxyz") << endl; cout << hand.find_last_not_of("abcdefghijklmnopqrstuvwxyz") << endl; }