Thanks, that did the trick. I also found that I could compile my program by using the following command line.
>c++ rand.cpp
I found the c++ binary within the /usr/bin directory. I'm not sure what this command is supposed to do (no man page), but it compiled my simple program above without any complaints. I think I'll stick to your suggestion, it just seems like invoking cc with the right flags is the more appropriate thing to do.