Update main.cpp

minor refactoring, added printing of all the iterations
project seems to be done