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的更多相关文章
- 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 ...
- cout.setf()
cout用来实现格式输出,类似于C语言中通过printf(). cout.setf()的作用是通过设置格式标志来控制输出形式,如,其中ios_base::fixed表示:用正常的记数方法显示浮点数(与 ...
- C++中cout.setf()和cout.precision()
这两个就是格式控制的~ostream成员函数里面的,也可以用输出流操作符来控制,都一样的~附给你一些看看~ 其中cout.setf跟setiosflags一样的,cout.precision跟setp ...
- C++中的cout.setf(ios::fixed)是什么意思?
问题描述:在阅读一段代码时,发现代码的最后一部分出现 ... cout.setf(ios::fixed); cout.setf(ios::showpoint); ... 解决: cout.setf() ...
- ANSI Common Lisp Practice - My Answers - Chatper - 3
Ok, Go ahead. 1 (a) (b) (c) (d) 2 注:union 在 Common Lisp 中的作用就是求两个集合的并集.但是这有一个前提,即给的两个列表已经满足集合的属性了.具体 ...
- 使用Proj库进行大地坐标转空间坐标、投影坐标的一个示例
最近研究了proj库的使用,自己写了一个小demo,仅供参考. void demoPROJ() { const char* wgs84 = "+proj=tmerc +ellps=WGS84 ...
- cout 格式化输出
一直习惯于C语言的printf函数来打印,突然有一天要用cout来打印,发现有点不适应. 原来cout也是有格式化输出的. 首先要引入头文件 #include<iostream> // 在 ...
- 第三方框架之ThinkAndroid 学习总结(一)
ThinkAndroid是一个免费的开源的.简易的.遵循Apache2开源协议发布的Android开发框架,其开发宗旨是简单.快速的进行Android应用程序的开发,包含Android mvc.简易s ...
- c/c++头文件_string
string, cstring, string.h 一.string头文件 主要包含一些字符串转换的函数 // sto* NARROW CONVERSIONS// sto* WIDE CONVERSI ...
随机推荐
- 网站(Tomcat)超线程宕机
网站大中午的又挂了····· 拷了日志如下: 2014-4-12 13:22:30 org.apache.tomcat.util.net.JIoEndpoint createWorkerThread信 ...
- C# and android and socket
利用TCP协议通过Socket编写的网络聊天工具1-客户端 利用TCP协议通过Socket编写的网络聊天工具2-通用类设计 利用TCP协议通过Socket编写的网络聊天工具3-服务器端设计
- 用javascript向一个网页连接接口发送请求,并接收该接口返回的json串
一般前端与后端的互交都是通过json字符串来互交的,我的理解就是与网页接口的来回数据传递采用的数据结构就是json.一般是这样. 比如后端的代码是这样的: @RequestMapping(value ...
- Qt编程之右键单击QTreeWidgetItem弹出菜单
其实有这个需求很好理解,就是我有个project manager,上面的TreeWidgetItem都表示一个工程,我需要右键创建新的工程,或者删除.这个在很多普通软件中也见得多.在弹出的菜单中加入相 ...
- LINK : fatal error LNK1000: Internal error during IncrBuildImage
一.下微软的补丁:KB948127补丁来解决,http://code.msdn.microsoft.com/KB948127.貌似安装了也不起作用二.如果下载的补丁没安装成功或下载失败,可以用下面的方 ...
- 在QLabel上点击获得的效果
一般说只在button中点击获得事件,作出相应的反应.而往往需要在QLabel上作出点击和触碰的效果. 我用qlabel做出了一个效果,当鼠标碰到label区域,label底下出现一条线,离开后线条消 ...
- 设计模式(九):Composite组合模式 -- 结构型模式
1. 概述 在数据结构里面,树结构是很重要,我们可以把树的结构应用到设计模式里面. 例子1:就是多级树形菜单. 例子2:文件和文件夹目录 2.问题 我们可以使用简单的对象组合成复杂的对象,而这个复杂对 ...
- 抛出异常的区别 throw 和throw ex
在面试的过程中提到了异常捕获的的几种用法,之前一直使用但是没有仔细留意,调试程序的过程中发现还是有区别的,主要区别在堆栈信息的起始点不同,下边我们通过实例来看这集中不同的抛出异常的方法. 一般我们推荐 ...
- 黑马程序员_Java_collections and Arrays(工具类)
collections collections工具类方法 1,static <T extends Comparable<? super T>> void sort(List&l ...
- 分布式内存对象缓存 memcached
分布式内存对象缓存 许多Web 应用程序都将数据保存到RDBMS中,应用服务器从中读取数据并在浏览器中显示.但随着数据量的增大,访问的集中,就会出现REBMS的负担加重,数据库响应恶化,网站显示延迟等 ...