Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to print numbers with only 2 digits after decimal point in c++

#include <iostream>
#include <iomanip>
#include <iostream>
​
int main()
{
	double d = 122.345;
	cout << fixed << setprecision(2) << d;
  	//the setprecision can vary as per required
}
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #print #numbers #digits #decimal #point
ADD COMMENT
Topic
Name
2+8 =