Update main.cpp

new main using list and loop.