From the classical description of how a solar system is formed: There is a lot of dust and it collides and it forms rocks than they collide and form miniplanets than they attract and collide and form planets and the sun.
I made a simulation in witch you start form 2 to 1000 objects (that would be the equivalent of miniplanets) and it calculates gravitational forces and plastic collisions until a sun and some planets are formed.
here is the wiki from where you can download the program
http://www.sfml-dev.org/wiki/en/projects/solarcreation (now how do I delete the other page?
)
Uh oh there aren't a lot of planets forming, I think it should have more than 1000 initial objects for a more realistic simulation but normal computers start to slow down a lot from 1000 up