Looks to me like you are using getche when you really should just be using getch
getche is same as getch, EXCEPT for getche also echos the character onto the screen. (Maybe that is what the "crazy characters" you were talking about were

)
An alternative would be to learn a bit of x86 assembly language, learn how to write inline asm, and then use the INT 16H interface for communicating with the keyboard. I believe Dev-C++ uses the highly annoying "AT&T style" of x86 assembly language. The IBM style is intuitive. The AT&T style is not. Good luck

(I haven't coded using the AT&T style before, personally)
BTW, INT 16H is a BIOS interrupt, so it should work on all x86 OSes unless the OS overwrites it. (Which, even in those cases, the OS' version of INT 16H usually ends up doing equivalent work or else calling the original at the end)
BTW, not sure if this will speed up your code any, but when you have something like
h = (h + 1);
you can instead write
h += 1;
for the same effect.
Also,
h = (h - 1);
can be
h -= 1;
steps = steps+1;
can be
steps += 1;
etc....
Generally, anything of the form
var = var mod num;
where "var" is your variable
"mod" is one of the following
+,-,*,/,%,<<,>>,^
and "num" is a number or other variable can be written in the form
var mod= num;
The way to print the screen once and then not have to slow it down anymore (in other words, then only printing the parts that changed, afterwards) is gonna be kinda tricky.
If this is a Windows GUI program, you will need to specify clipping regions for an InvalidateRect call, and then only InvalidateRect the area which you wish to be redrawn.
If this is a CLI application instead (Command Line Interface), then you might be able to find out which area of VRAM is being written to for screen display, and then directly write bytes there....but only to the places that need changes. Unless this runs as a DOS program through a prompt box, though, I'm not entirely sure that will work. (Oh, it'll work, but might not always work...might have some bad side-effects/etc....)
A simpler alternative which won't work quite as well, but which will work better than what you are doing would be to have some sort of a flag somewhere, set the flag ONLY when something changes/needs to be drawn, and then in your drawing function, at the top, check for the flag, and if it isn't set, exit the function, and otherwise draw. This might make your program so that if you move other windows on top of it, and then move those windows off, that "ghosting" will occur, however. Just be sure not to move windows on top of it, if you decide to implement this way.