#include #include using namespace std; int main() { string phrase; size_t pos{0}; int i; cout << "Please enter a phrase" << endl; getline(cin, phrase); i = 0; while(i < phrase.size() ) { phrase[i] = tolower(phrase[i]); i++; } cout << "The phrase is " << phrase << endl; /* The pattern is Get the first data if it is valid process the data get the next data. * */ pos = phrase.find("high"); while (pos < string::npos) { cout << "high was found at position " << pos << endl; pos = phrase.find("high",pos+1); } /* bad code * 012345678 * this is high */ /* while (pos < string::npos) { pos = phrase.find("high",pos+1); cout << "high was found at position " << pos << endl; } */ /* if(pos < string::npos) { cout << "high was found at position " << pos << endl; } else { cout << "high was not in the phrase" << endl; } */ return 0; }