小技巧——保留n位小数(n为输入的值)

    科技2022-08-15  91

    int n; //表示要保留的位数 double res; cin>>n>>res; printf("%.*lf\n", n, res); //保留n位小数这样写
    Processed: 0.010, SQL: 8