+ 3

Printf cout

differences between cout and printf

13th Apr 2017, 2:17 PM
szto
szto - avatar
7 Respostas
+ 11
Printf() is a function defined in stdio.h of C to print something on the screen, cout is a reference to an object of class ofstream defined in iostream.h, which is used to print something in C++
13th Apr 2017, 2:19 PM
Sachin Artani
Sachin Artani - avatar
+ 9
It's your perspective. Both are same but created in two different languages
13th Apr 2017, 2:20 PM
Sachin Artani
Sachin Artani - avatar
+ 5
which one is better ?
13th Apr 2017, 2:19 PM
szto
szto - avatar
+ 5
thx
13th Apr 2017, 2:21 PM
szto
szto - avatar
+ 2
If you are using C++, avoid using C functions (like printf). It is not a good practice. cout is designed to support c++ native features (like STL libraries) and to work the same way as any other output channel.
13th Apr 2017, 6:06 PM
Denis Felipe
Denis Felipe - avatar
+ 1
if u r using c++ use cout, if u are using c use printf..both do the same exact thing which is print the output on the screen.
13th Apr 2017, 2:37 PM
Simran Jeet Singh
Simran Jeet Singh - avatar
0
If we want to print a massage We use cout keyword
17th Apr 2022, 4:59 AM
Khalilullah abrahimi
Khalilullah abrahimi - avatar