+ 1
I donât know the exact mean of variable can some one explan me ?
6 RĂ©ponses
+ 4
Think of them like box's say we have int x = 100;
âŹ
"int" âȘ this box đŠ is for numbers
xâȘ is the đ· attached to the number đŠ with x written on it
= means store this
100 in number box đŠ labeled đ· x
If we open the box labeled x inside theres the value 100 so we now know box/variable x = 100 đ
+ 2
very nice tanks
+ 1
To put it as simple as i can.. A variable is like a container for some kind of value, it can be an integer value like â10â, a float/double value like â10.23â, can be a single char or an entire string value like âhello! iâam a variableâ, or a boolean value that is âtrueâ or âfalseâ.
When we declare a variable, the variable will request some space in the memory to store the value it is meant to..
If we declare an int variable like: int a = 3; then the variable will request the space in the memory to hold the value â3â. Variables after are declared, can be used and modified all the time we need in our program!
+ 1
thanks a lot i get it
+ 1
Variable is like a basket you can put number and characters in it
First step
What kind of thing you put in variable if you want to put integers then you use "int"
Second step
name of you variable
Let take "a" as name of variable
So let's creating variable program
Int main()
{
Int a;
cout << "Enter number in variable ";
cin >> a;
cout << a;
}
Explainion
cin >> a
Takes number you want to store in variable
And
cout << a
Print the number you store in the variable