Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

round double to 2 decimal places c++

double d = 0.12345;
std::cout.precision(2); // for accuracy to 2 decimal places 
std::cout << d << std::endl; // 0.12
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #double #decimal #places
ADD COMMENT
Topic
Name
5+8 =