From Cay Horstmann ( http://horstmann.com/)
[source language='c'] printf("%10.2f", x); [/source]
[source language='c++'] ++cout 1996: Java
[source language='java'] java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance(); formatter.setMinimumFractionDigits(2); formatter.setMaximumFractionDigits(2); String s = formatter.format(x); for (int i = s.length(); i 2004: Java
[source language='java'] System.out.printf("%10.2f", x); [/source]
comments powered by Disqus