How to stop on-screen 'churning'?

I am compiling and running a simple console-style
program and I find that, when I am running it, or when
I reset the program (if it stops in the middle), there is
a great deal of 'churning' of windows on the screen,
meaning that windows pop up for a fraction of a
second and disappear or there are parts of
windows showing.

Also, I get a black console popping up every
time I run it and the program does not have any
screen output and does not need a console.
Does anyone know how I can stop these things -
so that there is always a 'calm' screen during running
and there is no console.

With thanks,

Gerry