+ 1
use of cin
what is the difference between storing of some value using "cin" extraction and declaring the value initially like " int a=2"
5 Respostas
+ 18
int a=2;. //is assignment at the time of declaration
while
int a;
cout<<"enter a no";
cin>>a;
//is taking the value from user at time of execution
+ 14
You use cin when you want the value to be determined by the user, instead of being initialized by the programmer.
+ 1
If you declare a value like that, it will be a static value defined at compile time. Usually, the users don't have access to the code so they can change the value and compile again. It is also bothersome for users.
+ 1
cin is used to put the value according to your demand and nothing else.
+ 1
cin means console input. It is used to get input from the user.