finished main.cpp