- 1

What is the purpose of using cin ? Where we need to use cin?

I am a beginner

16th Apr 2020, 2:31 AM
Kay K
Kay K - avatar
7 Réponses
+ 3
It is used for input , like if you want a number from user then you can use cin. #include <iostream> #include<string.h> using namespace std; int main() { char name[30]; cout<<"Enter the name:"; cin>>name; return 0; }
16th Apr 2020, 2:36 AM
Raj Kalash Tiwari
Raj Kalash Tiwari - avatar
+ 3
To execute or run a program,you need input,sometimes input is given by default during coding time. for eg: int x=10; cout<<x; //to print x on the output screen But sometimes the user using it need to enter the value,then cin is used for that purpose! int x; cout<<"enter x"<<endl; cin>>x; /*any int value can be entered here unlike the above example, where it only takes 10*\ cout<<x;
17th Apr 2020, 7:33 AM
Tarun Teja
Tarun Teja - avatar
+ 2
Look at the code above, You can understand easily
16th Apr 2020, 2:37 AM
Raj Kalash Tiwari
Raj Kalash Tiwari - avatar
+ 2
For input data
16th Apr 2020, 2:51 AM
Cmurio
Cmurio - avatar
+ 2
Thankyou for give me answer
16th Apr 2020, 2:53 AM
Kay K
Kay K - avatar
+ 2
Cin takes input from console and store it in the variable.
17th Apr 2020, 1:25 PM
Simran Bansal
Simran Bansal - avatar
0
Very useful
16th Apr 2020, 3:02 AM
Kay K
Kay K - avatar