Difference between cin and scanf. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Difference between cin and scanf.

Could you tell me, what the difference between cin and scanf is? I would rather use scanf. Is there any advantage that cin has over scanf?

20th Dec 2016, 6:30 AM
Martin Brezáni
Martin Brezáni - avatar
5 Answers
+ 3
bro let me tell u scanf is faster than cin. u can use scanf in c++ but not cin in c. if ur program is small use cin. its easy to write. if ur program is big like really big then use scanf
20th Dec 2016, 7:08 AM
manish rawat
manish rawat - avatar
+ 1
cin is the object which takes input streams from keyboard, << is operator overloading in iostream. scanf is the fuction which does the same..
20th Dec 2016, 7:08 AM
Mock
Mock - avatar
0
cin is used in c++ and scanf in c thats the basic difference otherwise both do the same work.
20th Dec 2016, 6:45 AM
Deepak
Deepak - avatar
0
yes iostream is slower than cstdio yes you probably shouldn't use cstdio library which contains scanf , if your developing in c++ as someone mention above there are even faster ways to get I/o than scanf if you don't care about formatting inpput and blah blah ... .
20th Dec 2016, 7:23 AM
Mock
Mock - avatar
0
ahoj brezito dalo mi ta v odporucaniach som fedorov kamos a spoluziak oliver
19th Oct 2017, 5:45 PM
KiwiTheBird
KiwiTheBird - avatar