# include & lt; Iostream>
# include & lt; string>
# include & lt; Vector>
# include & lt; Cctype>
using namespace std;
Int main () {
String text="Good mornig!" ;
For (auto it=text. The begin (); it!=text. The end (); + + it) {
Char c=* it;
Coutreturn 0;
}
When the output is like this:

But if the right hand side put toupper:
c=toupper (c);
Cout
The normal output;![]()
Why ah?CodePudding user response:
Because toupper function return value is an int type, so direct output is plastic, but if use c=toupper, int is converted to char types, the output is the character typeCodePudding user response:
You use thec=toupper (c);is equivalent to implicitly convert an int to the char