Alright, I'll explain in a little more detail how to do exactly what you'll need to do:
First, create a folder somewhere that you'd like to use as your code folder. It's probably going to be in your ~/Documents folder or in /Developer.
Once that folder has been created, copy this C++ program and save it as "HelloWorld.cpp" into that folder:
Code:
#import <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
Then, open the Terminal (you can find it in the Utilities folder in the Applications folder). In it, type cd *space*, but don't press return. Now go over to the window showing you the folder you created, showing the files it contains, and drag the tiny folder icon from the title bar (at the very top of the window) into the Terminal. Terminal will dump a path to that folder in. Now, in the Terminal, press return. What you've just done is to change the directory from your home folder (selected by default) to the folder which you create your code in.
You can type pwd and press return to print the path of the directory you're in (print working directory) to make sure you're in the right place.
Now type ls (that's a lowercase 'LS') and press return. That'll output all the visible files in that folder.
Now to compile your C++ program, just type:
g++ HelloWorld.cpp
That'll run HelloWorld.cpp through the GCC 3.3 Compiler (in Panther) or the GCC 4.0 Compiler (in Tiger).
To see your compiled program at work, type
and press enter.
You should see "Hello World!" outputted.