Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #print #float #number #places #decimal #point
ADD COMMENT
Topic
Name
7+1 =