is cout more advansed than printf??????
Printable View
is cout more advansed than printf??????
cout == C++
printf == C
Since I learned C++ before C I'm accustomed to using cout! But I think with printf you don't need to type as much.
this is an example ofCode:printf
you have to print *****more******thanCode:
printf("hello world");
Code:cout<<
Actually when outputing variables I think printf is quicker with its %v's than cout with its << v's.
If you're trying to learn C++, stick to the standard IO streams that C++ uses. You really should go read a book and stop asking trivial questions.
print( "Here is a number %d.", number);
cout << "Here is a number " << number << ".";
The benifit, as it were, of the new C++ streams is that you really don't have to implicitly set the type of all your variables to make them print right. You just stick the variable name in the argument line:
cout << a_number << a_string << a_float << a_char;
Whatever one you pick, don't mix and match them in the same program. (IE: don't use both printf and cout in the same program.) It makes your code ugly and is generally considered bad form.
Quzah.
thanks i get the point
wtf is up with that poll?
i wanted to make one
Apparently the same thing that's up with their sig. :DQuote:
Originally posted by moi
wtf is up with that poll?
Quzah.
WHAAAA???????????????????????:confused:
What's multitasking got to do with printf and cout?
cout is more typesafe than printf
get gcc and heed the warning messages.Quote:
Originally posted by Polymorphic OOP
cout is more typesafe than printf
Although it might me quicker, but I think that the cout is more readable.Quote:
Originally posted by abrege
Actually when outputing variables I think printf is quicker with its %v's than cout with its << v's.