Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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

#include <cstdio>
#include <iostream>

int main() {
    double total;
    cin>>total;
    printf("%.2f
", total); 
    //one can use the C function to print the decimal points
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #print #numbers #digits #decimal #point
ADD COMMENT
Topic
Name
3+7 =