You can put the text in a string and use the string::find function to search for text.
But what are your circumstances?
Where does the text come from? How much of it is there? What does "highlight" mean? How are you presenting the output? Does the text include line breaks? If it does, should those be part of the search?
the text input from users like
string text, value;
cout << " Enter string ";
cin >> text;
cout << " Enter the word or character you want to search ? ";
cin >> value;
And we print the text again but the word u search will be different color or in highlight.
like find" r "in the text : abcderder234
and the text after searching is :