Answers for "c++ set print precision"

C++
0

set precision in c++

#include <iomanip.h>
#include <iomanip>
int main()
{
    double num1 = 3.12345678;
    cout << fixed << showpoint;
    cout << setprecision(2);
    cout << num1 << endl;
}
Posted by: Guest on September-16-2021
1

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

Browse Popular Code Answers by Language