Whats the difference between assigning a value to a variable and inputing a value through cin | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Whats the difference between assigning a value to a variable and inputing a value through cin

15th Jun 2019, 11:52 AM
Chidi Anioke
3 Answers
+ 7
When you read user input via cin, this value still needs to be stored in a variable. When you generally assign a value to a variable it is done within the code by assigning a constant, the value of another variable, or the result of a calculation to the variable without taking any user input. However, assigning user input via cin into a variable could also be considered a special case of variable assignment.
15th Jun 2019, 12:44 PM
Sonic
Sonic - avatar
+ 2
That you cin takes user input (and assignes a value), but assigning a value can the computer do without any interaction
15th Jun 2019, 12:00 PM
Airree
Airree - avatar
+ 2
Airree, thank you so so much but your answer is kind of not linking. I am trying to grab what u said.
15th Jun 2019, 12:06 PM
Chidi Anioke