I am using code blocks to write codes. I suck, I am new, I do not understand computer slang, now with that said how do i declare a variable in c+ + code?
@bravojuliet:
If you want a number without any fractional part (ie. -7, 3, or 2398), you'd declare it like this:
int nameOfYourIntegerGoesHere;
For larger numbers, use "long" (8 bytes) instead of "int" (4 bytes), and for smaller numbers, use "short" (2 bytes) or "char" (1 byte). You can also declare a variable that is strictly nonnegative with the "unsigned" keyword:
unsigned int NameOfYourIntegerGoesHere;
If you want a number with a fractional part (ie. 0.5, 12.4, or -0.003) you'd use a "float" or "double" (which allows both larger and more precise numbers than a float) instead:
float nameOfYourFloatGoesHere;
So in general, it's <font color="#0099FF">variabletype</font> <font color="#99FF00">variablename</font> <font color="#FF0099">semicolon ( ; )</font>
I say don't bother :p There's sooo much tutorials everywhere
Also personally if you simply want to learn to code i recommend C# or Visual Basic using Visual Studio Express (it's 100% free).
IntelliSense is so good at understanding how stuff works, how to keep correct syntax etc. it helps a ton.
Visual Basic have more human syntax and its quite easier to begin with. Functionality wise differences are very small compared to C# as they are basically the same languages but with different syntax
Another personal opinion: C++ is old :p it's more like this core language where everything have to be done manually. You gain raw control but at price of complexity and exposing to various bugs and incompatibilities
I am using code blocks to write codes. I suck, I am new, I do not understand computer slang, now with that said how do i declare a variable in c+ + code?
Get any C+ + for beginners book and read it.
thanks de programmel
I say don't bother :p
There's sooo much tutorials everywhere
Also personally if you simply want to learn to code i recommend C# or Visual Basic using Visual Studio Express (it's 100% free).
IntelliSense is so good at understanding how stuff works, how to keep correct syntax etc. it helps a ton.
Visual Basic have more human syntax and its quite easier to begin with. Functionality wise differences are very small compared to C# as they are basically the same languages but with different syntax
Another personal opinion: C
++
is old :p it's more like this core language where everything have to be done manually. You gain raw control but at price of complexity and exposing to various bugs and incompatibilities