Coding main.cpp logic.