"%11.2lf" of C++ is equivalent to ?
You guys have any resource that shows the equivalent formats for both Java and C++?
"%11.2lf" of C++ is equivalent to ?
You guys have any resource that shows the equivalent formats for both Java and C++?
Boost Format. http://www.boost.org/doc/libs/1%5F37%5F0/libs/format/doc/format.html#syntax
It has the basically the same formatters as printf().
But they are type safe and can be used on streams.
Short answer: The Java equivalent is "%11.2f"
.
In C's printf()
(but not scanf()
), %f
and %lf are equivalent; Both take a double
argument.
In Java's Formatter.format()
, %f
is legal but %lf
is not. %f
works for Float
, Double
and BigDecimal
values.