Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Just curious. I havent programme

Status
Not open for further replies.

butthead

Programmer
Feb 24, 2002
545
US
Just curious.

I havent programmed much for dos lately and
I never got much into the cin, cout stuff.
Is there an advantage other than the syntax
and saving perhaps a few keystrokes on code
generation. Or is the cout more efficient on
my cpu than printf.
 
I don't think there's much, if any, efficiency difference. The main upside to cin and cout is that they're type-safe and extensible. That is, with printf, if you try to print a character with "%s", you'll get strange results, and there's no way to define a format specifier for types you've created. C++-style streams get around both of those problems; a char will print as a char unless you explicitly tell it to print as something else. You can easily define operators to work with C++ streams and any type you define.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top