Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to convert a string into 16 binary number
How to convert a string into 16 binary number
Character type is a kind of integer type, which can be converted into int type and then output in hexadecimal form. The following is a sample program.

# Contains? & ltiostream & gt

Use? Namespace? std

int? Master ()

{

Charles? str_test[]? =? "hello? World \ n ";;

int? Limit? =? strlen(str _ test);

For what? (int? inx = 0; ? inx! = limit; ? ++inx)?

//Use static_cast to convert the character type to int type.

cout & lt& ltstr _ test[inx]& lt; & lt"-hex:" & lt; & lt hex< static _ cast & lt (str _ test [inx]) < & lt”\ t”;

cout & lt& ltendl

Return? 0;

} program execution results: