This is the source code for my gravity simulation project. DISCLAIMER: Keep in mind it started out as a simple test when I was learning C++ in university. So the code is horribly organized. I am also Norwegian, so some stuff might be in Norwegian. I've tried to make it easier to understand.
Using Runge-Kutta 4 instead of Euler integration might help increasing the accuracy of the simulation while improving performance.
See Gaffer on Games for a good presentation of the principle.