std::setw
场景:没分了也要问!std:setw()的有关问题
没分了也要问!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>
没分了也要问!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>