void ConvToCaps (string &input_str) { ostringstream strout_str; for (unsigned int i = 0; i < input_str.length(); i++) { if (input_str[i] <= int(122) && input_str[i] >= int(97)) //See if char is lowercase { strout_str << char(input_str[i] - 32); //Convert uppercase char to lowercase char input_str.replace(i, 1, strout_str.str()); //Replace lowercase part of str with strout_str.str(string()); //Erase the stringstreams contents } //uppercase equivalent } }