Update main.cpp

Added the while loop