指定输出外观的常数。
namespace std {
class ios_base {
public:
typedef implementation-defined-bitmask-type fmtflags;
static const fmtflags boolalpha;
static const fmtflags dec;
static const fmtflags fixed;
static const fmtflags hex;
static const fmtflags internal;
static const fmtflags left;
static const fmtflags oct;
static const fmtflags right;
static const fmtflags scientific;
static const fmtflags showbase;
static const fmtflags showpoint;
static const fmtflags showpos;
static const fmtflags skipws;
static const fmtflags unitbuf;
static const fmtflags uppercase;
static const fmtflags adjustfield;
static const fmtflags basefield;
static const fmtflags floatfield;
...
};
}
备注
支持在 ios的操控器。
该类型是描述对象可以存储格式标志的位掩码类型。清单的标志值(元素)是:
dec,插入或提取整数值为十进制格式。
hex,插入或提取整数值以十六进制格式。
oct,插入或提取整数值为八进制格式。
showbase,插入一个显示生成的integer字段的基础的标题。
internal,到一个字段的宽度填充根据需要通过插入空白字符在内部的一个指向生成的数字字段。有关设置字段宽度的信息,(,请参见 setw)。
left,到一个字段的宽度填充根据需要通过插入空白字符在一个生成的字段(左对齐)的末尾。
right,到一个字段的宽度填充根据需要通过插入空白字符在一个生成的字段(右对齐)开头。
boolalpha,对类型 bool 插入或提取对象作为名称(例如 true 和 false)而不是数值。
fixed,插入浮点值以定点格式(没有指数字段)。
scientific,插入浮点值采用科学格式(使用指数字段)。
showpoint,插入一个生成的浮点字段无条件地小数点。
showpos,插入加号在非负生成的数字字段。
skipws,在某些提取前跳过的前导空格。
unitbuf,每插入后刷新输出。
uppercase,为小写字母大写插入相当于某些插入的。
此外,许多有用的值为:
adjustfield,为 internal定义的位掩码 | left | right
basefield,定义为 dec | hex | oct
floatfield,定义为 fixed | scientific
以修改这些格式标志的功能的示例,请参见 ios 成员 (在操控器下)和 <iomanip> 成员。
要求
标头: <ios>
命名空间: std