I dont understand cin why do i use it and how do i use it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I dont understand cin why do i use it and how do i use it?

27th Dec 2016, 1:47 PM
KongShi
9 Answers
+ 6
variable "a" will get user input value.
27th Dec 2016, 1:53 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 6
Output is decided by the user.
27th Dec 2016, 1:53 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 5
It's the opposite of cout , used for input instead of output: int a; cin>>a; cout<<a;
27th Dec 2016, 1:51 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 4
cin gets input from a user for a variable. int age; cout <<"Please enter your age"; cin>>age; where age is a variable.
27th Dec 2016, 2:46 PM
Wazir
+ 2
What will happen when i use cin
27th Dec 2016, 1:52 PM
KongShi
+ 2
What will the output be
27th Dec 2016, 1:53 PM
KongShi
+ 2
cin is an object of class ifstream that uses method >>(insertion) to get input from user
27th Dec 2016, 2:17 PM
Anuj Tiwari
Anuj Tiwari - avatar
+ 2
no the >> insertion function does it but cut is an object that is used to access the >> method you can consider it as a pre defined operator function of class istream and cut is an object thus as in general case an object is used to access member function and parameter is passed in it the sales the case here
27th Dec 2016, 2:48 PM
Anuj Tiwari
Anuj Tiwari - avatar
+ 1
Its a way to take the user input and store it in a variable.
29th Dec 2016, 8:27 AM
Mohit Kulkarni
Mohit Kulkarni - avatar