Give
Curses or ncurses (linux) a whirl. Someone else will most certainly post some complicated algorithm to organize your data. But when I see some text-display problems, I automatically reach for curses. It's insanely easy to use and learn. You'll be using some move() commands.