Your code is written in a hybrid C/C++ style. For instance your destructor has a delete
(I can't find where the corresponding new
is) and that is basically never needed. Use a std::vector
to store array-like data.
Also you do a lot of parameter passing like void Nbody::update_position(Particle *p)
. Use references instead, and use const Particle &p
is the particle is only read.
Otherwise it looks like an n-body code to me. It's quadratic rather than something smarter, but that's probably ok.