When I try to use tolower on a string, rather than making the letters lowercase, the program converts them to random symbols. Here is my code:
#include <iostream>
#include <locale>
using namespace std;
int main()
{
string hi= "thTSMSdjNnJlJjnJJKn";
for (int i=0; i<hi.length(); i++)
{
hi[i]+=tolower(hi[i]);
cout << hi[i];
}
}
This is the output: Þð╚ã║ã╚È╝▄┤Ï┤È▄┤┤Â▄
What is wrong with it? This isn't the actual code that I want to use tolower on but I just put it in a separate example so it was more clear. I don't mind using to upper either but the main thing is that I get all the letters in the string to be the same case.