std::setw(size)与std::setfill(char)
头文件:
#include <iostream>
#include <iomanip>
using namespace std;
功能:
std::setw :需要填充多少个字符,默认填充的字符为' '空格
std::setfill:设置std::setw将填充什么样的字符,如:std::setfill('*')
示例:
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <iomanip> int _tmain(int argc, _TCHAR* argv[])
{
int a = ;
//输出: 1
std::cout<<std::setw()<<a<<std::endl;
//输出: ***1
std::cout<<std::setw()<<std::setfill('*')<<a<<std::endl; //输出:***12
int b = ;
std::cout<<std::setw()<<std::setfill('*')<<a<<b<<std::endl;
system("pause");
return ;
}
std::setw(size)与std::setfill(char)的更多相关文章
- VC++ : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_string<wchar_t,struct std::char_traits<wchar_t>
最近学习Google Breakpad,将其用在了自己的项目中,编译的版本为VS2010,没有什么问题.但是为了和之前的程序兼容,需要使用VS2008版本的程序,于是又编译了VS2008版本的代码,但 ...
- 你想知道的 std::vector::push_back 和 std::vector::emplace_back
引言 C++ 11 后,标准库容器 std::vector 包含了成员函数 emplace 和 emplace_back.emplace 在容器指定位置插入元素,emplace_back 在容器末尾添 ...
- 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)'
error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Tra ...
- error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler op
caffe c++11编译问题 问题:error: #error This file requires compiler and library support for the ISO C++ 201 ...
- std::array中的std::get<n>()
模板函数std::get<n>()是一个辅助函数,它能够获取到容器的第 n 个元素.模板参数的实参必须是一个在编译时可以确定的常量表达式,编译时会对它检查. get<n>()模 ...
- 使用log4cplus时遇到的链接错误:无法解析的外部符号 "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,
#include "stdafx.h" #include <log4cplus/logger.h> #include <log4cplus/loggingmacr ...
- Error 2 error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)'
Error 2 error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree ...
- 将std::array转换成std::tuple
template<typename Array, std::size_t... Index> decltype(auto) array2tuple_impl(const Array& ...
- mod_tile编译出错 -std=c++11 or -std=gnu++11
make[1]: 正在进入文件夹 /home/wml/src/mod_tile-master' depbase=echo src/gen_tile.o | sed 's|[^/]*$|.deps/&a ...
随机推荐
- 云计算共享组件--时间同步服务NTP(2)
一.标准时间讲解 地球分为东西十二个区域,共计 24 个时区 格林威治作为全球标准时间即 (GMT 时间 ),东时区以格林威治时区进行加,而西时区则为减. 地球的轨道并非正圆,在加上自转速度逐年递减, ...
- C语言|作业07
一.本周作业头 这个作业属于那个课程 C语言程序设计II 这个作业要求在哪里 https://i-beta.cnblogs.com/posts/edit;postId=11811545 我在这个课程的 ...
- [Bzoj1001][BeiJing2006]狼抓兔子(网络流/对偶图)
题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=1001 看到大佬们都是对偶图过的,写了个最大流水过去了QAQ,网络流的无向图直接建双向边( ...
- CodeForces 820B + 821C
(点击题目即可查看原题) 820B Mister B and Angle in Polygon 题意:在一个正n边形中,每个顶点按顺序记为1~n,正n边形中任意三点顶点组成一个角,∠x1x2x3,问 ...
- Hive 教程(十)-UDF
hive 虽然自带了很多函数,但是毕竟有限,无法满足所有业务场景,用户可以自定义函数来实现特定功能 UDF user define function,用户自定义函数 可以分为 3 类 UDF:一进一出 ...
- Linux-1.1root初始密码设置,切换root用户
Ubuntu安装好后,root密码需要自己设置 root初始密码设置 sudo passwd root 权限不够时,切换root su 回车后输入密码 exit 退出登录的账户
- CE修改器使用教程 [入门篇]
Cheat Engine 一般简称CE,是一个开放源代码的作弊软件,其功能包括:内存扫描.十六进制编辑器.调试工具,Cheat Engine 自身附带了外挂制作工具,可以用它直接生成外挂工具,CE可以 ...
- windows系统下nginx+tomcat+redis做负载均衡和session粘滞附整套解决方案
Nginx: 在nginx-1.8.0\conf目录下找到nginx.conf文件,打开文件修改文件中http{}中的内容,在http{}中加入 upstream localhost { serve ...
- Linux shellcode sample
Linux shellcode sample HelloWorld.nasm ;HelloWorld.asm ;Author: Kul Subedi global _start section .te ...
- debezium关于cdc的使用(上)
博文原址:debezium关于cdc的使用(上) 简介 debezium是一个为了捕获数据变更(cdc)的开源的分布式平台.启动并指向数据库,当其他应用对此数据库执行inserts.updates.d ...