Which one is better?
I prefer cout < printf
cout
printf()
Either
Neither
Which one is better?
I prefer cout < printf
Last edited by Yoshi; 12-05-2001 at 09:45 AM.
Yoshi
I have to say cout. I was raised on it...
i prefer cout
i can't wait to use it again, learning c at the moment... *sigh*
>i can't wait to use it again, learning c at the moment... *sigh*<
C++ is backwards compatible with C, right? If you know C++, then you know C.
Unless, do you mean you're learning how to write programs entirely in C using no C++?
That depends on what you term 'knowing' a language. with C++, for instance, you are freed / shielded from some relatively low-level procedures, such as memory allocation and I/O. Although C also provides some functions for these, there are some things in C that a typical C++ programmer will not need to use - malloc() for instance.
Peter Kimberley
[email protected]
it depends on what you are trying to use......If it is a simple game, i prefer using the putch(''); command, but it only outputs one variable. If your just outputting a message you want the user to know, use cout<<""; command. If you want a message at a sertian spot, use gotoxy(x, y); command and the cprintl(""); ((or whatever it is ). It just depends on what you are doing.
Code:#if _emo #define stereo_type_i_dislike #endif
Well, you can do c by just using conio and stdio.h, and, instead of #include<stdio.h> its #include "stdio.h"...and you can't use classes. Thats really the only difference.
<<"command and the cprintl("");"
its printf() or if your using conio sprintf to copy a string to a variable, and cprintf() not cprintl
I like cout myself. You don't need to worry about \'s as much, and it looks neater. Also I think cout runs faster. sprintf() Might be the same, I never used it. I saw it in Andre Lamthe's Game Programming in 21 Days though
printf() all the way... you gotta have the formating
---------------
starX
www.axisoftime.com
>> printf() all the way... you gotta have the formating
same here. or maybe it's because I almost never used cout.
>>Also I think cout runs faster.
I think printf() is faster. I vaguely (very very very vaguely) remembered a discusion on the old board. and I think it was Sunlight who wrote a program to test it and printf() was faster.
(or was it the other way around, oh well)
Printf: faster
Printf: Cleaner
Printf: Flexable
Cout<< slow
Cout<< easy
Cout<< grew up on it.
Close, but I say Printf.
"If you tell the truth, you don't have to remember anything"
-Mark Twain
Only one thing.
Cout works also under graphics, (#include <graphics.h>), so quite better than some terrible outtextxy(...); <- parameter must be char* so it is'nt so simple typing some float or etc. in graphics
without cout (you must use smth. like ftoa(...) to transform it to char* and then use outtextxy(...))
PS: cin>> also works
printf is nicer, it formats the text for you, and I grew up with it.
Camilo
no, life is nice, just a girl fooling around, alcohol fixes everything.
OH, I now have a High School Diploma and need of ron (drink)
I've always wondered about the question in bold above... Anyway, back to the subject. I think people who are beginners at programming are going to vote for cout. Most course teach it first, and so they're more used to it. My first reaction when I saw the poll, was printf, because it's used in traditional function notation (as opposed to the overloaded extraction and insertion operatros used in cout), and I think simple things work better... but then of course I realized how they get the little extraction operators to work, so now I have no opinion, and I'm asking that same question..... What do you prefer? cout or printf();?