Enter function using keypad

I recommend to stop wasting your time guessing what C/C++ code looks like. No wonder that you are struggling.

There are plenty of language guides and coding tutorials to study.