To run cpp on your mac os x 10.5.4, u need to install the Xcode package from the DVDs you were given with your machine. The 2nd DVD contains the Xcode package.
First open the xCode application by typing open -a xcode in the terminal window. u can also do it manually, for that you need to go,
Macintosh HD –> Developer –> Applications –> Xcode
Now, from File menu select New Project, then Command Line Utility, and finally select C++ Tool.
Choose the folder where you want to save the project. Enjoy programming in cpp on your favorite macbook :).