You can use SyntaxHighlighter. It will unobtrusively enhance code samples on your page with specific syntax highlighting for a wide range of languages.
Here's an example for C++
// my first program in C++
#include
using namespace std;
int main ()
{
cout << "Hello World!";
return 0;
}