It’s not as hard as it might sound. Modern languages have nice libraries and frameworks that make input and basic graphics very easy. Here’s a tutorial for Slick (a Java-based 2D game framework) that walks you through how to do exactly what you ask:
http://slick.cokeandcode.com/wiki/doku.php?id=01_-_a_basic_slick_game
It’s not as hard as it might sound. Modern languages have nice libraries and frameworks that make input and basic graphics very easy. Here’s a tutorial for Slick (a Java-based 2D game framework) that walks you through how to do exactly what you ask: http://slick.cokeandcode.com/wiki/doku.php?id=01_-_a_basic_slick_game
Here’s a tutorial for how to make Tetris: http://slick.cokeandcode.com/wiki/doku.php?id=02_-_slickblocks
I’m sure similar things exist for C++, especially since it’s the most popular language for making games in.
edit: If you want to actually follow one of the above tutorials, see this setup info first: http://slick.cokeandcode.com/wiki/doku.php?id=getting_started_and_setup