As Delfi says, use Double Buffering.

Traditionally, the screen was cleared to allow sprites to be quickly drawn to the screen at a new location, erasing the sprite at the last location.

Before it became inexpensive to blit an image from memory to the screen every frame, there were many tricks used to minimise the amount of data written to the screen each frame.
The simplest of these was to clear the screen.
Another method was to use dirty rectangles, this involved a lot more work, but still allowed you to only update a single surface and only copy the areas which had changed..

It's much faster to bulk fill a piece of memory with 0 than it is to copy from another location, so clrscr was used a lot of the time for simple apps.

The major downside is that if you clrscr on the memory used to draw to the screen, there is a good chance that this image will be drawn to the monitor before you've had a chance to draw the rest of your images.. hence the flicker.

So, the double buffering method was created.

You have 2 pieces of memory. One of which you fill with the current frame's data.

Once a scene has been rendered 100%, you make the completed image, the current display image. Then you work on the other image, swapping the buffers as the images are completed.

This means that you've always got an in-progress image and a completed image. The completed image being the one currently on display.

This method means there is no flickering but it does mean that you need 2 pieces of memory to render to, effectively doubling the video memory requirements for your game.

This technique doesn't just apply to bitmapped graphics either, it applies just as well to text based games.


So basically,

2 pieces of memory. Working and Display.
You render to the Working surface , then flip your surfaces once you're finished. So current working image becomes current display image.
Keep repeating this as you complete frames and you'll get no flickering as the monitor always displays a completed image.

Some libraries like SDL help you to do this by hiding the mechanics from you, requiring that you only call SDL_flip (or something like that) if you're doing it yourself, you'll have to do a bit of research to find the best way. (ready made libraries are great )

I hope this helps and Good luck.

[size=9px]If I've made an error in my description or terminology and you spot it, you know enough to not be in the help me forum [/size]