Declaring variables. I r newb.
Hallopeople. :O
I'm new to C, and C++. Reading a pretty old book as well, written...no idea when. Anyways, the book is by Sam A. Abolorous. It's called 'Learn C In Three Days'. Possible, not possible, I don't know considering I wanna take my time with programming and not burn through it. Rushing it, learning it, then when you try to apply it to something else, your like what? No, I wanna learn it properly so I can apply it wherever needed.
Anyways, back to the question. o_o So the book has a code...and it gives an example of declaring variables. I tried inputting that code, TRIED modifying it and still no luck. I get errors. I'll post the code I tried. Keep in mind I used MICROSOFT VISUAL C++.
The code from the book.
Code:
*****#include <stdafx.h>
#include <stdio.h>
main()
{
//Declarations.
int a;
float b;
//Assignment.
a=1024;
b=512;
//Display output.
printf("%d\n",a);
printf("%f\n",b);
}
Thanks to whoever helps me out.

^_^
EDIT: I dunno how to use the code thingy...so I apologize about that. ._.
EDIT: Thanks Zeco for teaching me how to put the code.
ALRIGHT, whee. I used DevC++, and it worked. I somewhat changed the script so it pauses for a while.

Thanks Why06 for the tip. FINAL:
Code:
#include <stdio.h>
#include <conio.h>
int main()
{
//Declarations.
int a;
float b;
//Assignment.
a=1024;
b=512;
//Display output.
printf("%d\n",a);
printf("%f\n",b);
getch();
}