+ 2

Can I use printf ans scanf in the place of cout and cin ..?

5th Jul 2016, 5:26 PM
Amine Demagh
Amine Demagh - avatar
6 Réponses
+ 5
cout & cin are part of the iostream interface for input and output. They are an ostream object and an istream object, respectively. They use the overloaded << operator to output any object, based on its type and the various flags set by manipulators. printf and scanf are part of the stdio.h interface also known as cstdio. They are variable-argument functions, which use a format specification to tell them what the types of their arguments are. Some find the iostream interface easier, and it is safer and expandable. However, these advantages come at a small performance penalty. printf and scanf on the other hand are a bit faster, but are unsafe, and some find them harder to use.
6th Jul 2016, 11:56 AM
Hassan Khan
Hassan Khan - avatar
+ 4
Yes you can use but you have to include header file. Example : #include<conio.h>
9th Jul 2016, 3:01 PM
MOHD FAIZAN UMAR
MOHD FAIZAN UMAR - avatar
+ 2
Of course. They're faster than cin and cout.
5th Jul 2016, 8:04 PM
Mihai Dancaescu
Mihai Dancaescu - avatar
+ 1
yes u can all the codes of C language can be used in C++
5th Jul 2016, 5:37 PM
Shubham Lamichane
Shubham Lamichane - avatar
+ 1
No.Print f and scan f should be used only in C
22nd Jan 2017, 4:21 PM
saiabi
0
thanks guys
8th Jul 2016, 1:51 PM
Blessing Tayedzerwa
Blessing Tayedzerwa - avatar