Update main.cpp

Add key event