C++ 编译时'setw' was not declared in this scope问题

学习C++时,对cout输出设定域宽时,使用setw()后编译报错:'setw' was not declared in this scope

C++ 编译时'setw' was not declared in this scope问题_第1张图片

在网上查询,发现是需要include一个文件:#include ,添加后重新编译,如图

C++ 编译时'setw' was not declared in this scope问题_第2张图片

运行结果如下

C++ 编译时'setw' was not declared in this scope问题_第3张图片

你可能感兴趣的:(C/C++,域宽,declared,in,this,sco,setw,C++)