#include #include using namespace std; int main() { string phrase; size_t pos{0}; int i{0}; cout << "Enter a phrase "; getline(cin, phrase); i = 0; while( i < phrase.size() ) { phrase[i] = tolower(phrase[i]); i++; } cout << "Phrase is: " << phrase << endl; pos = phrase.find("high"); while (pos < string::npos) { cout << "high is at position " << pos << endl; pos = phrase.find("high", pos+1); } /* * this is bad bad bad bad bad while (pos < string::npos) { pos = phrase.find("high", pos+1); cout << "high is at position " << pos << endl; } */ /* if ( pos != string::npos ){ cout << "high is in " << phrase << endl; } else { cout << "high is not in " << phrase << endl; } */ return 0; }