Personally, I like cout. What do you guys think?
- SirCrono6
cout
printf
Personally, I like cout. What do you guys think?
- SirCrono6
From C to shining C++!
Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
- Bubba
IDE and Compiler - Code::Blocks with MinGW
Operating System - Windows XP Professional x64 Edition
I actually learned C++ before I learned C, so I prefer cout.
However, I have heard the printf is slightly faster. I am not sure if this is true or not, but it is what I have heard.
Still, cout is quite nice. A quick overload of the << operator can make it output pretty much anything. It is pretty nice.
I think if you are programming console, it doesnt really matter which you use. Not many people care about the miniscule difference in how fast text is outputted in console mode.
cout is not used very much in GUI programming, although I do use fstream's quite a lot. fstreams are VERY nice things to have. I love them.
I like printf..... because it's the only one I ever learned. I've taken 3 C classes and have never messed with C++ so far.
cout is more like javascript. I like c's % thingy much more control and easier to output.
>I like c's % thingy much more control and easier to output
Agreed. And if you wish you can apply this style formatting to buffer output if you are using a text setup that isn't the console (ie a graphics setup, that's what I used in AktiF). Though it takes a bit of work, it's worth this rather than redefining formatting yourself.
hasafraggin shizigishin oppashigger...
Gee, this hasn't been done before
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
cout or printf? None.
I like sprintf best cout & printf ain't cool for GUIs.
when I do console stuff, I prefer printf, in fact, I always use C's stdio instead of C++'s iostream.
cout has nifty type-checking. and you can define it for use with new objects you create, like string objects. anything you can do with printf can be done with cout using manipulators.
I use cout because I don't know how to use printf... it looks like you can have more control over it, which would appeal to me if I actually bothered to learn how to use it...
Join is in our Unofficial Cprog IRC channel
Server: irc.phoenixradio.org
Channel: #Tech
Team Cprog Folding@Home: Team #43476
Download it Here
Detailed Stats Here
More Detailed Stats
52 Members so far, are YOU a member?
Current team score: 1223226 (ranked 374 of 45152)
The CBoard team is doing better than 99.16% of the other teams
Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)
Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT
Hey is there any equivalent for sprintf() under C++?
No, cout is faster than printf because cout has compile-time type-checking whereas printf has to parse a string.Originally posted by DavidP
However, I have heard the printf is slightly faster. I am not sure if this is true or not, but it is what I have heard.
std::stringstream in <sstream>Originally posted by DavidP
Hey is there any equivalent for sprintf() under C++?
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
>>No, cout is faster than printf because cout has compile-time type-checking whereas printf has to parse a string.
didn't Sunlight proved that it's the other way around, or is my memory playing tricks on me?
printf is faster than cout. You can try measuring the execution time between there and you'll see the big discrepancy, in favor of printf. cout sucks.
I don't know how to use printf. All those %'s and whatever, I can't keep em straight.
"Think not but that I know these things; or think
I know them not: not therefore am I short
Of knowing what I ought."
-John Milton, Paradise Regained (1671)
"Work hard and it might happen."
-XSquared