C language mode:
Use the printf () function to output integer values in %d format, characters in %c format and all ascii output codes:
# Contains? & ltstdio.h & gt
Invalid? Master ()
{
int? Me; ? //I can also define it as unsigned here? Charles? Type, the following code makes no difference.
For (? I = 0; I< 128; i++? )?
printf("%c? :? %d\n ",me,? Me? ); ? //Output different types of data in different formats with the same variable value.
}C++ mode:
Directly convert related types, such as:
# Contains? & ltiostream & gt
Use? Namespace? Sexually transmitted diseases ;
Invalid? Master ()
{
For (? int? I = 0; I< 128; i++? )?
cout? & lt& lt? (char)I & lt; & lt"? :?" ? & lt& lt? Me? & lt& ltendl? ; ? //(char)i integer variables are output by characters.
For (? Not signed? Charles? ch = 0; ch & lt 128; ch++? )
cout? & lt& lt? ch & lt& lt"? :?" ? & lt& lt? (int)ch? & lt& ltendl? ; ? //(int)ch character variables are output by shaping.
}