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. Entity Framework with MySQL 学习笔记一(拦截)

    参考 : http://msdn.microsoft.com/en-us/data/dn469464.aspx EF 允许我们在发送SQL请求和返回数据时做一些拦截的动作 比如可以自定义写 log , ...

  2. 8051单片机I/O引脚工作原理

    一.P0端口的结构及工作原理 P0端口8位中的一位结构图见下图: 由上图可见,P0端口由锁存器.输入缓冲器.切换开关.一个与非门.一个与门及场效应管驱动电路构成.再看图的右边,标号为P0.X引脚的图标 ...

  3. 为何某些公司不允许使用C++ STL?

    说几个STL的缺点吧,虽然都是在比较极端的情况下出现,但是对于一些大项目还是会遇到的 1. 代码膨胀问题每一个实例化过的模板类,都会膨胀出一份独立的代码,比如std::vector<std::s ...

  4. Android开发 解决AlertDialog中的EditText无法调出输入法的问题

    在AlertDialog中使用自定义的View,如果View中有EditText,在上面点击,默认是跳不出软键盘的,不是焦点的问题.解决方法,有两种,一是把AlertDialog换成Dialog,但这 ...

  5. 【HDOJ】3184 All Can Do

    简单数学题. #include <cstdio> #include <cstring> #include <cstdlib> int main() { int t; ...

  6. 算法导论(第三版)Problems2(归并插入排序、数列逆序计算)

    讨论内容不说明,仅提供相应的程序. 2.1:归并插入排序θ(nlgn) void mergeInsertionSort(int a[], int l, int r, int k) { int m; & ...

  7. Findbugs初探-使用idea获取findbugs插件

    /* * 整天忙于无限重复的黑盒测试,不论是写脚本,还是手工测,都难以脱离黑&&灰盒测试,所以忽然间想,大学时期学过的所有课程就这样扔掉吗?不好!既然选择了做测试,那么就要一直坚持下去 ...

  8. CSS常用操作-导航栏

    1.垂直导航栏 index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8" ...

  9. java socket报文通信(一) socket的建立

    TCP是Transfer Control Protocol的 简称,是一种面向连接的保证可靠传输的协议.通过TCP协议传输,得到的是一个顺序的无差错的数据流.发送方和接收方的成对的两个socket之间 ...

  10. (转)利用ant在Mac 下自动化打包签名Android程序

    1.创建一个android项目 参数说明:-k /--package 为命名空间(包名)-a /--name 工程名-p /--path 项目 -t 为目标平台的版本编号 命令:./android c ...