【基础语言】对于cin和cout的耿直

如何让cin和cout更快?

我们知道,cin和cout的速度是小于scanf和printf的,因此我们需要加快读入和输出的速度.
以此我们可以添加如下语句:

{
    ios::sync_with_stdio(false)
}//用于int main()之前

或者

ios::sync_with_stdio(false)

cout保留小数

保留小数代码如下:

cout<<setprecision(1)<<std::fixed<<x;

猜你喜欢

转载自blog.csdn.net/ronaldo7_zyb/article/details/81049820