TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ANTHONY TIBBS
from: MIKE WALKER
date: 1997-03-31 17:46:00
subject: Streams

Anthony Tibbs wrote in a message to Mike Walker:
 AT> Well, I am relatively new to the C++ programming language (more
 AT> familur with C), but,  I can offer a few.  Some of these could be
 AT> on either side - good or bad.  It depends on what you are trying to
 AT> do, and what your personal preferences are. 
Me too, I'm in the process of moving from pascal to C++. 
 AT> While the printf() function is generally around two kilobytes in
 AT> size (depending on the compiler and such), the cout "operator" is
 AT> quite small. 
If you use a combination of the two methods this advantage tends to 
disappear. Both cout and printf code would be linked to your program. 
 AT> The printf() function is much easier to use when trying to output
 AT> elaborate (such as columnur) text.  
I can see this, from what I have done so far I can see that cout lines tend 
to get a little wordy.
 AT> The printf() function requires you to specify *exactly* what you
 AT> are outputting, why cout leaves it up to the system to figure out
 AT> what type of data you are outputting.  (I haven't yet had it go
 AT> wrong, but ...)
Hmmm.... is this a good thing or a bad thing?
 AT> When displaying a date, it would be much easier to use
 AT> printf ("Date is %d/%d/19%d\n",month,day,year);
 AT> than
 AT> cout << "Date is " << month << "/" << day << "/19" << year << "\n";
A perfect example of the cout wordyness that I mentioned above. Now I'm 
wondering which is more efficient when it comes to cpu ticks.
   Mike....
--- timEd 1.10+
---------------
* Origin: Arcadia [New Westminster, BC] (1:153/831.4)

SOURCE: echomail via exec-pc

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™.