TIP: Click on subject to list as thread! ANSI
echo: nthelp
to: Geo
from: John Beckett
date: 2004-10-24 12:54:16
subject: Re: Organizing source code

From: John Beckett 

"Geo"  wrote in message
news::
> cout formatting is easy

Yes, but printf allows me to remember a small number of rules that allow me
to easily do stuff like show a float with 2 fractional digits, or show an
integer in hex using lowercase a-f. Align left/right is easy. And some
more. Some of the cout equivalents are pretty weird.

> you see this as elegant?

It's elegant because you can define your own classes (containing arbitrary
data), with your own methods to perform stream i/o. Example:

// Book is a class defined elsewhere.
Book b("The Selfish Gene", "Richard Dawkins",
"Oxford", 29.95); cout << b << newl;    // output
value of b

> shouldn't that be 4.0/5.0 instead of leaving the zero off

I would definitely write 4.0 (rather than 4.). I was making the point,
however, that 4. is valid and is a double, whereas 4 is an int.

John

--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270 5030/786
@PATH: 379/45 1 396/45 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.