The example your text illustrates is the language from which the 'shortcut' version that hk_mp5kpdw provided is derived.

Unless I'm mistaken, this is compiler-dependent, however. Borland supports it, though I'm not certain that MSVC++ does, for example. (I reformatted my hard drive recently and have yet to reinstall MSVC++. Just might do that in case other questions of this sort pop up. )

Your source is not at all incorrect, so don't immediately start questioning its content. In fact, you may want to investigate further into the method your book demonstrates so that you know the foundations of the language rather than relying on shortcut versions that may not be portable.

Btw, char data is left-justified by default while numeric data is right-justified. (Someone jump in and correct me if I've mixed the two up!) Something else to consider when you format your output, anyway.

-Skipper