I would suggest using a library like ncurses. Doing this from scratch is pretty tough, but, if you really want, you need to use a lot of printf's and functions to write a character at a certain position.
Here you will find more ncurses alternatives for windows: NCurses-Like System for Windows