Completed task c with cpp method, made main.cpp more usable.