共用方式為


hex

Specifies that integer variables shall appear in base 16 notation.

ios_base& hex( 
   ios_base& _Str 
);

Parameters

  • _Str
    A reference to an object of type ios_base, or to a type that inherits from ios_base.

Return Value

A reference to the object from which _Str is derived.

Remarks

By default, integer variables are displayed in base 10 notation. dec and oct also change the way integer variables appear.

The manipulator effectively calls _Str**.**setf(ios_base::hex, ios_base::basefield), and then returns _Str.

Example

See dec for an example of how to use hex.

Requirements

Header: <ios>

Namespace: std

See Also

Reference

iostream Programming

iostreams Conventions