• setf


    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 等前缀。

     

  • 相关阅读:
    vue项目搭建过程2 -- 使用 vue cli 4.0 搭建 vue 项目
    vue项目搭建过程1 -- 环境搭建
    升级node.js版本
    git的初步了解
    期末总结
    四则运算的封装
    用户故事
    0~10的随机整数运算
    创业近一年在博客园总结一下,希望给来者一点借鉴
    PV与并发之间换算的算法换算公式
  • 原文地址:https://www.cnblogs.com/gaoxianzhi/p/3222713.html
Copyright © 2020-2023  润新知