printf("%10.2f", x);
1988: C++
cout <<>
1996: 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
System.out.printf("%10.2f", x);
Nav komentāru:
Ierakstīt komentāru