Answers for "c++ float precision digits"

C++
2

how to print 5 precision float in c++

#include <iostream>
#include <cstdio>
using namespace std;

int main() 
{
    // This code helps you to print a number with desired decimal
    double Number=10.3454;
    printf("%.3lf",Number);

    return 0;
}
Posted by: Guest on June-07-2020
0

Setting a number of decimals on a float on C++

cout.setf(ios::fixed);
cout.precision(2);
Posted by: Guest on July-17-2021

Browse Popular Code Answers by Language