set precision in c++ no decimal places\ code example
Example 1: how print fload wiht 3 decimal 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;
}
Example 2: set precision with fixed c++
int x = 109887;
cout << fixed << setprecision(3) << x;
Example 3: set precision in c++ no decimal places\
14049.304930000