You can use some library like PDCurses.
Ask yourself: do you really need to erase everything on screen?
If I had run some program and lost diff result I use in my current work, I'll probably remember to never use programs written by this programmer. EDIT: And "cls: Command not found" which will pop up every time when I launch your program isn't making it look good :)
I'll explain. I'm making a program wich in its start has a login, register and exit menu. Imagine you need to register, you don't want that after that it shows everything you have done. So you would want to clear the screen. And I for now all my projects are directed to windows only so my problem isn't about OS dependency, it's about the slowness and the security gap. I think there should be a way to do this without using the system() commands. Altough I'm not worried about OS dependecy it's very likely to become a problem in the future if try to expand my horizonts. And if I use PDCurses what does it do and how does it do it?
Ok, but you forgot to check for other special symbols (like TAB, escape, and others) and possibility to use backspace to delete last char will be neat, but this is good too.
So, did you decide on something? Do you really need it on console?
I said console because I'm still learning to programm and I still barely know c++. So for now I'm sticking to the console. When I have learned enough and I can make a good console aplication will start using libraries like PDCurses or even more seriusly OpenGL or DirectX. I started programming with the objective of making a game so my goal will be OpenGL.