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. ulimit小结

    1. limits是一个进程的资源,会被子进程继承   2. soft limit -S, hard limits -H hard limits只能被root用户修改,启动的时候会加载配置/etc/s ...

  2. win7 snmp

    http://blog.chinaunix.net/uid-21857285-id-3340206.html

  3. Git Bash下实现复制粘贴等快速编辑功能

    在windows下使用Git Bash会经常用到选中.复制.粘贴等功能,但是一般用的方法会很复杂,笔者经过查阅一些资料,特整理一些常见编辑功能的实现方法. (1)默认方法: 单击左上角的logo ic ...

  4. HDOJ 1303 Doubles(简单题)

    Problem Description As part of an arithmetic competency program, your students will be given randoml ...

  5. Codeforces Round #203 - D. Looking for Owls

    D. Looking for Owls Emperor Palpatine loves owls very much. The emperor has some blueprints with the ...

  6. 解决 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

    "Accept-Encoding": "gzip, deflate", 这条信息代表本地可以接收压缩格式的数据,而服务器在处理时就将大文件压缩再发回客户端,IE ...

  7. socket实例1

    第一个例子创建了一个java工程,用来测试Socket的连接功能,通过浏览器可访问,地址为:127.0.0.1:端口号 MyServerSocket.java, package com.jikexue ...

  8. ios 数组倒序和数组转字符串

    NSMutableArray *array = [NSMutableArray arrayWithObjects:",nil]; NSArray* reversedArray = [[arr ...

  9. SEO_Alexa排名

    1.Alexa排名是评价某一网站访问量的一个指标,对SEO优化没有任何作用,这个数据是可以做假的,考虑Alexa排名纯粹是在浪费时间. 2.Alexa排名是针对已经在浏览器中安装了Alexa Tool ...

  10. sqlyog v11.24注册码

      ccbfc13e-c31d-42ce-8939-3c7e63ed5417 a56ea5da-f30b-4fb1-8a05-95f346a9b20b a0fe8645-3916-45d4-9976- ...