Added cin error handling to main.cpp