In this problem I use C++. I have a for loop that uses string variable 'word' and should return this word in uppercase.
for(int i=0;i<word.size();i++){
cout<<toupper(word[i]);
}
However, instead of word itself it returns its ASCII code. And, when I write it this way, everything works fine
string a;
for(int i=0;i<word.size();i++){
a=toupper(word[i]);
cout<<a;
}
I'm just curious why is that happening, why can't toupper() return string variables.