Like bubz said, asynckeystate() will be extremely easy for you to understand, but it's also incapable of capturing lower-case letters, some characters will be given back as some random utf-8 garbage, and it's terrible with punctuation marks.
Grab yourself an IDE and some c/c++ tutorials. Not a lot of people will recommend you do that, especially if you are new to programming, but you will be able to make exactly what you want, and you will have to force yourself to learn how to program better.