hey, i'm brand new at this programming stuff, but i'm really interested in learning c++. i've downloaded a compiler and have been reading a few tutorials, etc. online about basic things like variables, strings, and integers but.. i'm just not sure where to begin. I'm not in a class or anything, i'm just teaching myself, and if i could compile a small, beginner program (successfully), it would really give myself something to work off of and help me to learn it more thoroghly than just reading it on a tutorial.
really, any single bit of help you can give me to actively put what i've been reading to use would be greatly appreciated.
The following code is probably the very first C++ program that most people compile:
1 2 3 4 5 6 7 8 9
#include <iostream>
usingnamespace std;
int main (void)
{
cout << "Hello World!" << endl;
return 0; //this entire line is optional
}
It simply writes "Hello World!" (without the quotes) to the console. In fact, this is sort of a de-facto standard in programming. The first program in any language, using any API almost always has "Hello World!" in some form. One exception that I know of is PHP, which uses the phpinfo() function to determine whether PHP actually is working. If it works, then you're ready for PHP programming, basically.
To stay on-topic, I would recommend trying some of the things that you've been reading. In fact, this site has a tutorial of its own with example code. Check it out at http://www.cplusplus.com/doc/tutorial/ if you haven't already.