loading

How to use PC keyboard input with Arduino Mega 2560?

I wanted to read in input from the keyboard of my computer so that the motor connected to my arduino reacts a certain way when I press a certain button. How would I read in something like numbers or letters being typed in on the keyboard. Is there something like "cin<< ;" like there is in other C++ software? For example if the number "1" is pressed then my motor will turn on and if a "2" is pressed then it will turn off.   

Get the serial protocol description for a standard (PS2) keyboard.
Get the pinout of the same.
Connect the keyboard according to the pinout with the power supply and inputs of your Arduino.
Check the Arduino code libraries for the serial communication and implement the code for the keyboard for your purpose.
If you need certain actions for a key you will have to program it as well.