首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

没分了也要问!std:setw()的有关问题

2012-02-06 
没分了也要问!std::setw()的问题#includeiostream#includestringusingnamespacestdintmain(){cout

没分了也要问!std::setw()的问题
#include   <iostream>
#include   <string>
using   namespace   std;
int   main()
{
cout   < <   setw(10)   < <   "hello,world! "   < <   endl;
return   0;
}
===================================
error   C2065:   'setw '   :   undeclared   identifier
靠啊!还少什么头文件?为什么不能用啊!

[解决办法]
#include "iomanip "

using namespace std;

[解决办法]
标准库中的格式化流操作符,大部分在 <iostream> 中,如果该操作符需要参数,例如setw(n),那么它们都被放在 <iomanip> 中,包含它。
[解决办法]
#include <iomanip>
加上就OK了
[解决办法]
#include <iomanip>

热点排行