C++ 编程中何时使用 #include <iomanip>
在 C++ 编程中,我们使用 #include
下面是一个使用 #include
#include <iostream>
#include <iomanip>
int main() {
double number = 3.14159;
// 设置输出的精度为2
std::cout << std::setprecision(2);
// 输出 number 并设置字段宽度为 10,并用空格进行填充
std::cout << std::setw(10) << number << std::endl;
return 0;
}
以上代码中,通过使用 #include
原文地址: http://www.cveoy.top/t/topic/n3q 著作权归作者所有。请勿转载和采集!