std::setw(size)与std::setfill(char)
来源:互联网 发布:java中static什么意思 编辑:程序博客网 时间:2024/06/09 05:40
#include <stdio.h>#include <tchar.h>#include <iostream>#include <iomanip>int _tmain(int argc, _TCHAR* argv[]){ int a = 1; //输出: 1 std::cout<<std::setw(4)<<a<<std::endl; //输出: ***1 std::cout<<std::setw(4)<<std::setfill('*')<<a<<std::endl; //输出:***12 int b = 2; std::cout<<std::setw(4)<<std::setfill('*')<<a<<b<<std::endl; system("pause"); return 0;}
头文件:
#include <iostream>
#include <iomanip>
using namespace std;
功能:
std::setw :需要填充多少个字符,默认填充的字符为' '空格
std::setfill:设置std::setw将填充什么样的字符,如:std::setfill('*')
- std::setw(size)与std::setfill(char)
- std::setw(size)与std::setfill(char)
- 出现setw(size)与setfill(char)有关的缺失问题
- setw()与setfill()
- std::setw 格式化输出
- setw空格与setfill填充以及width
- setw(n),setfill(char c),setbase(int n)函数练习
- ?: %04d snprintf string(type char) setw(int n) setfill(*)
- std::string 与 char* 之间的转换
- setw和setfill函数
- setfill、setw 和 setprecision
- setfill、setw 和 setprecision
- const setfill setw
- setfill和setw总结
- 关于std::string.length() std::string.size()
- std::__stl_throw_length_error(char const*)
- std::string to char*
- std::string 的length()与size()方法没有区别
- VS2008常用快捷键
- 设计模式之十二:组合模式(composite)
- 设置VS2008 快捷键 快速注释
- 黑马程序员_Java基础Day02(上)_Java语言基础(Done)
- OCJP之Container
- std::setw(size)与std::setfill(char)
- 图书管理系统
- 控制台程序 如何查看所有的输出结果
- java判断回文数
- java里reverse 算法描述
- 研发漫画之一:评审三部曲,抓壮丁、科普会、批斗会
- Intent 使用篇
- OCJP之正则 更新中。。。
- linux下svn服务器安装和配置