Computer Science, asked by gargnidhi1977, 1 year ago

Difference between cin and gets in c++

Answers

Answered by Riyasharma98
2
cin is used for taking input from the user during runtime let me give you an example if I am gonna write a program to calculate the area of square and I am allowing the user to enter the value of side during the runtime then we use this c i n..
but talking about gets it is actually used for most of the cases like when I am allowing the input to be a string. now what is a string??

string is nothing much Rocket Science but it's basically like your name for example Johnson and we use gets for that cases.
for example gets name is used in order to extract or take input of name from the user during program.
Answered by Anonymous
1
HEY MATE HERE IS YOUR ANSWER--

cin is an istream type object(variable) while cin.get() is invoking a function get() with it. In C++, >> is also a function. In both the cases, a function is getting invoked with cinobject which takes a character from key board and returns the same.

KEEP CALM
AND
SUPPORT
✌EHLI
JĀÑTÄ
Similar questions