You compile C programs with gcc:
$ gcc program.c
For C++ programs:
$ g++ program.cc
The executables are usually named a.out, so you run them with
You can change the name of the executable with the -o option:
$ g++ test.cc -otest
This will give you an executable named test, which you can run in the same way as above. Read the man pages for gcc and g++ for more options you can use with them.