共用方式為


setbase

Set base for integers.

T3 setbase( 
   int _Base 
);

Parameters

  • _Base
    The number base.

Return Value

The manipulator returns an object that, when extracted from or inserted into the stream str, calls str.setf(mask, ios_base::basefield), and then returns str. Here, mask is determined as follows:

  • If _Base is 8, then mask is ios_base::oct.

  • If _Base is 10, then mask is ios_base::dec.

  • If _Base is 16, then mask is ios_base::hex.

  • If _Base is any other value, then mask is ios_base::fmtflags(0).

Example

See setw for an example of using setbase.

Requirements

Header: <iomanip>

Namespace: std

See Also

Reference

iostream Programming

iostreams Conventions