How to convert a word a full word to uppercase if it is lowercase in a string

The problem I am facing is that I have to output the C++ input file and display every line of code in the output, except in the output I have to convert every if, else, and while as IF, ELSE, WHILE. I tackled the first part and now its onto the 'easier' part even though I am very unsure about it!
If anyone has any suggestions let me know.
The simplest way would be to do a find and replace operation on a copy of the original source code file with just about any text editor in existence. But if that's not an option then you can read the file in a whole line at a time and store that line in an std::string. Then use the "std::string::find()" member function to look and see if the words are present in that line and if they are use the "std::string::replace()" member function to overwrite them.

- std::string::replace(): http://www.cplusplus.com/reference/string/string/replace/
- std::string::find(): http://www.cplusplus.com/reference/string/string/find/
Topic archived. No new replies allowed.