Q:

To convert the whole string we need to call toupper on each character and put the result back in that character

0

To convert the whole string we need to call toupper on each character and put the result back in that character.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

string s("Hello World!!!");
// convert s to uppercase
for (auto &c : s) // for every char in s (note: c is a reference)
c = toupper(c); // c is a reference, so the assignment changes the char in s
cout << s << endl;

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now