Answers for "how to display decimal till three places in cpp"

C++
1

how to print fixed places after decimal point in c++

cout << fixed << setprecision(n)<<variable; //n is number of places needed after decimal point
Posted by: Guest on July-08-2021
0

print float number with only four places after the decimal point in c++

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

int main()
{
  value = 3.15647;
  std::cout << std::fixed << std::setprecision(2);
  std::cout<<value<<std::endl;
	return 0;
}
Posted by: Guest on March-10-2022

Code answers related to "how to display decimal till three places in cpp"

Browse Popular Code Answers by Language