Answers for "set precision in c++"

C++
3

setprecision in c++

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

int main()
{
   int num = 45;
  cout << "it is: " << fixed << setprecision(2) << num << " the end"<< endl;
  
  return 0;
}
Posted by: Guest on September-28-2020
3

set precision with fixed c++

int x = 109887;
cout << fixed << setprecision(3) << x;
Posted by: Guest on July-06-2020
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
0

setprecision in c++

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
  int i = 18;
  cout<<setw(10)i;
}
Posted by: Guest on August-29-2021

Browse Popular Code Answers by Language