|
|
back to boardDigits after the point C++ Posted by MiR 25 Jul 2006 13:53 How to show 6 digits after the point using double/float variable? Re: Digits after the point C++ You can do one of the following ways : 1) fprintf(stdout,"%.6lf ",n) ; or printf("%.6lf",n) ; 2) setprecision( 6 ) ; cout << n ; /* in this way , it won't print out the last zero digits. for instance : if n == 0.777 , it will print out "0.777" in stead of "0.777000" if n == 0.777001 , it will print out exactly 6 digits after the decimal point ( "0.777001" ) */ Edited by author 25.07.2006 15:55 Re: Digits after the point C++ Posted by MiR 25 Jul 2006 16:08 Thanks! Re: Digits after the point C++ Posted by KAV 25 Jul 2006 19:29 cout.precision( 6 ); cout << fixed << variable; Re: Digits after the point C++ what if i want zero digits? using c++, not c Edited by author 28.08.2010 00:39 |
|
|