Can anyone of you tell me about the difference between using cout cin and print or scanf? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can anyone of you tell me about the difference between using cout cin and print or scanf?

and plzz also tell why and when to use them .

28th Oct 2016, 11:58 AM
Vishal Kumar Rana
Vishal Kumar Rana - avatar
5 Answers
+ 1
cout is an object used to display the result to the output console. cin is an object used to read from the input console. Both cout and cin are objects of c++ <iostream> header files. specific to c++ printf() is a function defined to display the output to the output console with format specifier(%d, %l and so on). scanf() is also a function defined to read the input from the input console with the format specifier as mentioned above. Both Printf() and scanf() are defined inside the stdio.h header file. We can use the printf and scanf function in C and C++ as well as c++ is extended from c.
6th Jul 2017, 12:38 PM
balachandar karnan
balachandar karnan - avatar
0
cout is for show something for display and cin is for get a value for keyboard print and scanf is the same but in another enviroment like java
3rd Nov 2016, 12:19 AM
Gerardo Romero
Gerardo Romero - avatar
0
cout and cin are used in c++ program printf and scanf are used in c program
7th Jul 2017, 3:14 PM
ashraf ram
ashraf ram - avatar
0
cin is advanced form of scanf.Here we dont use format specifiers.we directly use variable name ex:cin>>a; cout is used to display the data...
8th Jul 2017, 1:40 PM
Sai Pranav
Sai Pranav - avatar
0
printf and scanf are used in stdio.. they both are same. .but.. see the structure of c++ ..so we have to write cout and cin
15th Jul 2017, 2:24 PM
geetha
geetha - avatar