If you want to make the contrast more dramatic, add some plain text, a variable-length string, and an integer in hexadecimal. How many lines does it take to do this in Ada, C++, or Java: printf("The result for %-30s is %10.2f (%08x)\n", x, y, z); My question: Has anyone written good Ada equivalents to printf and scanf? On Wed, 3 Mar 1999 09:28:37 -0500 [log in to unmask] wrote: > > I thought you might enjoy this recent post by Cay Horstmann to the > > Advanced Placement in Computer Science list. > > Let's include Ada in chronological order: > > > How do you print a floating-point number with field width 10 and two digits > > after the decimal point, using only the standard library? > > > > C > > printf("%10.2f", x); > > > > > > Ada > > Put (Item => X, > > Fore => 7, -- width = Fore + Aft + 1 (the point) > > Aft => 2, > > Exp => 0); > > > > > > C++ > > cout << setw(10) << setprecision(2) << showpoint << x; > > > > > > Java > > java.text.NumberFormat formatter > > = java.text.NumberFormat.getNumberInstance(); > > formatter.setMinimumFractionDigits(2); > > formatter.setMaximumFractionDigits(2); > > s = formatter.format(x); > > for (int i = s.length(); i < 10; i++) > > System.out.print(' '); > > System.out.print(s); ------------------------------------------------------------------------- Mike Bates FlightSafety Simulation Staff Engineer [log in to unmask] 2700 North Hemlock Circle Computer Systems Group 918-259-5598 Broken Arrow, Oklahoma 74012 -------------------------------------------------------------------------