Hi guys, I'm writing a small piece of code that will allow the user to input a sentance, and will return the sentance in all uppercase characters. The problem is, as soon as a "space" character is entered the program considers the input to be finished. I don't understand why. At first I thought that maybe it would be the space symbol causing problems so I wrote the code to disregard the character if it was a space symbol. This still didn't help. Also, if I input spaces before writing anything else, the program just skips the spaces, and returns the input after in uppercase.
This is my original code:
string upper(string sentance){
string s = sentance;
for (int i=0; i < sentance.size(); i++)
{s[i] = toupper(sentance[i]);}
return s;
}
Thanks for the help!