0

i cant understand what is variable!

16th Jul 2016, 3:33 PM
Jeff Funtilar
Jeff Funtilar - avatar
9 Answers
+ 3
Like people have said, a variable stores information, depending on the data type. Data types include things such as "int" (integer), for whole numbers, "float" for decimal values, "double" for more precise decimal values, "bool" for true/false, "string" for a sentence, etc etc. These are some of the very basic data types for variables you will encounter, but you will find a lot more as you advance. When creating a variable, we first write the data type (take "int" for example): int We then declare the variable name, to whatever you like. It would be ideal if variable names were not incredibly long, and that the name clearly states, as best as possible, what the variable is used for in the program: int age After this, we can choose to end the line with a ';'. Ta-da! Your variable is created! You can now manipulate it however you like, by using std::cin (to get input from the user), or simply do a line such as "age = 18;". Or, we could choose do declare what data our variable holds as soon as we declare it: int age = 18; Hope that helps!
16th Jul 2016, 6:24 PM
Cohen Creber
Cohen Creber - avatar
+ 1
Ha ha.
16th Jul 2016, 3:44 PM
Indra Kumar
Indra Kumar - avatar
+ 1
how?
16th Jul 2016, 3:46 PM
Jeff Funtilar
Jeff Funtilar - avatar
+ 1
variable is used to store a value depending on the type of value we use datatype s into,float, char etc egs int a; //integer value is stored inside a float a;//float value is inside a char ch; value can assign at the time of declaration int a=0; more variable (same type)can declare and initialize in a line as int a,b; we read the variable value while pgm is running using read statements
16th Jul 2016, 3:52 PM
Learner
Learner - avatar
+ 1
variable means which have the ability to change the digit.
17th Jul 2016, 10:06 AM
omkar singh pal
omkar singh pal - avatar
0
variables are used to define or hold any value
16th Jul 2016, 3:48 PM
Indra Kumar Sonkar
Indra Kumar Sonkar - avatar
0
like x and y? or 12345 etc? sorry i hate math. haha lol
16th Jul 2016, 3:51 PM
Jeff Funtilar
Jeff Funtilar - avatar
0
thank you for that answer i read that carefully !
16th Jul 2016, 3:56 PM
Jeff Funtilar
Jeff Funtilar - avatar
0
a variable is a identifier
17th Jul 2016, 11:54 AM
Akshat Jain
Akshat Jain - avatar