Hey guys so here is my code. I want to convert string to upperCase i.e "Hello World" to "HELLO WORLD". But i am getting this error, have no idea what this is. New to C++ :p
Here is what the prof asked me to do: "The function upConvert is to turn a C++ string of ascii characters into a dynamically allocated character array (old-style C-string) of appropriate size. The character array must have the same ascii characters as the string except all lower case characters turned into upper case."
char* upConvert(const string& s ){
for(unsigned int l = 0; l < s.length(); l++)
{
s[l] = toupper(s[l]);
}
the error i am getting:
read-only variable is not assignable
s[l] = toupper(s[l]);
Aucun commentaire:
Enregistrer un commentaire