added compare functionality to HW6's main.cpp