ios_base::fmtflags:  使用setf函数设置 

independent flags boolalpha read/write bool elements as alphabetic strings (true and false).
showbase write integral values preceded by their corresponding numeric base prefix.
showpoint write floating-point values including always the decimal point.
showpos write non-negative numerical values preceded by a plus sign (+).
skipws skip leading whitespaces on certain input operations.
unitbuf flush output after each inserting operation.
uppercase write uppercase letters replacing lowercase letters in certain insertion operations.
numerical base
(basefield)
dec read/write integral values using decimal base format.
hex read/write integral values using hexadecimal base format.
oct read/write integral values using octal base format.
float format
(floatfield)
fixed write floating point values in fixed-point notation.   ---------usually used  将浮点数用定点数表示
scientific write floating-point values in scientific notation.                                       科学计数法
adjustment
(adjustfield)
internal the output is padded to the field width by inserting fill characters at a specified internal point. 特定处补零
left the output is padded to the field width appending fill characters at the end.            结束补零
right the output is padded to the field width by inserting fill characters at the beginning. 开头补零

std::cout.setf ( std::ios::showbase );  带0x 等前缀。

setf的更多相关文章

  1. Difference between SET, SETQ and SETF in LISP

    SET can set the value of symbols;   SETQ can set the value of variables;   SETF is a macro that will ...

  2. cout.setf()

    cout用来实现格式输出,类似于C语言中通过printf(). cout.setf()的作用是通过设置格式标志来控制输出形式,如,其中ios_base::fixed表示:用正常的记数方法显示浮点数(与 ...

  3. C++中cout.setf()和cout.precision()

    这两个就是格式控制的~ostream成员函数里面的,也可以用输出流操作符来控制,都一样的~附给你一些看看~ 其中cout.setf跟setiosflags一样的,cout.precision跟setp ...

  4. C++中的cout.setf(ios::fixed)是什么意思?

    问题描述:在阅读一段代码时,发现代码的最后一部分出现 ... cout.setf(ios::fixed); cout.setf(ios::showpoint); ... 解决: cout.setf() ...

  5. ANSI Common Lisp Practice - My Answers - Chatper - 3

    Ok, Go ahead. 1 (a) (b) (c) (d) 2 注:union 在 Common Lisp 中的作用就是求两个集合的并集.但是这有一个前提,即给的两个列表已经满足集合的属性了.具体 ...

  6. 使用Proj库进行大地坐标转空间坐标、投影坐标的一个示例

    最近研究了proj库的使用,自己写了一个小demo,仅供参考. void demoPROJ() { const char* wgs84 = "+proj=tmerc +ellps=WGS84 ...

  7. cout 格式化输出

    一直习惯于C语言的printf函数来打印,突然有一天要用cout来打印,发现有点不适应. 原来cout也是有格式化输出的. 首先要引入头文件 #include<iostream> // 在 ...

  8. 第三方框架之ThinkAndroid 学习总结(一)

    ThinkAndroid是一个免费的开源的.简易的.遵循Apache2开源协议发布的Android开发框架,其开发宗旨是简单.快速的进行Android应用程序的开发,包含Android mvc.简易s ...

  9. c/c++头文件_string

    string, cstring, string.h 一.string头文件 主要包含一些字符串转换的函数 // sto* NARROW CONVERSIONS// sto* WIDE CONVERSI ...

随机推荐

  1. 位运算反(~)与(&)异或(^)或(|)右移(>>)左移(<<)

    原文:位运算反(~)与(&)异或(^)或(|)右移(>>)左移(<<) 先知道这两个二进制数据的特点:   1=0000 0000 0000 0000 0000 000 ...

  2. PHP上传文件出现文件名被截掉第一个字符的问题

    最近用PHP做了一个简单的上传功能,结果出现了一个意想不到的问题.我上传的文件,在获取$_FILES的时候发现文件名的第一个字符被截掉了,因为最开始上传的一直是数字或者字母为名称的文档,也没有太在意这 ...

  3. 【笔试&面试】C#中的程序集

    1.      C#中的程序集(Assembly) 答:程序集是包含一个或多个类型定义文件和资源文件的集合.它允许我们分离可重用类型的逻辑表示和物理表示. 程序集是一个可重用.可实施版本策略和安全策略 ...

  4. FILTER的执行次数和驱动表问题

    drop table test1; create table test1 as select * from dba_objects where rownum<1000; drop table t ...

  5. HDU3473--Minimum Sum(静态区间第k大)

    Minimum Sum Time Limit: 16000/8000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tota ...

  6. HDU4452 Running Rabbits

    涉及知识点: 1. direction数组. 2. 一一映射(哈希). Running Rabbits Time Limit: 2000/1000 MS (Java/Others)    Memory ...

  7. HDU-4857(拓扑排序)

    Problem Description 糟糕的事情发生啦,现在大家都忙着逃命.但是逃命的通道很窄,大家只能排成一行. 现在有n个人,从1标号到n.同时有一些奇怪的约束条件,每个都形如:a必须在b之前. ...

  8. HER COFFEE夜场代金券【1折】_北京美食团购_360团购导航

    HER COFFEE夜场代金券[1折]_北京美食团购_360团购导航 HER COFFEE夜场代金券

  9. 《图解HTTP》 第11章 web的攻击技术

    11.1 针对Web的攻击技术 简单的HTTP协议本身并不存在安全性问题,所以协议本身几乎不会成为攻击的对象. 11.1.1 HTTP不具备必要的安全功能 11.1.2 在客户端即可篡改请求 在HTT ...

  10. 控制反转(IOC)/依赖注入(DI)理解

    个人学习笔记,来自Acode. 1.术语 控制反转/反向控制,英文全称“Inversion of Control”,简称IoC. 依赖注入,英文全称“Dependency Injection”,简称D ...