Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to print a decimal number upto 6 places of decimal in c++

#include <iostream>
#include <iomanip>

int main()
{
    double d = 122.345;

    std::cout << std::fixed;
    std::cout << std::setprecision(2);
    std::cout << d;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #print #decimal #number #upto #places #decimal
ADD COMMENT
Topic
Name
2+5 =