Added if code. Added error checking to cin. Fixes.