how to make c++ loop fast

I was making a snake game with a cpp code. i created the snake and the borders with a for loop but when i play the game i can clearly see the loop running. creating the borders and clearing the screen and creating it again. what i wanted was that the borders would be fixed and only the snake is moving. what can i do?
1
2
3
4
5
6
  // the basic structure of the borders
for(;;)
{
show_border();
system("cls");
}
the console was not meant to run at 80 frames per second :)

cls is slow.
writing text to the screen is slow.
there are some nonstandard cursor position tools that will let you move the cursor to a specific location to over-write just a few characters rather than update the whole screen every iteration.
I think those are in <conio.h> for windows, look for (google) gotoxy() I think is the name of the function? Its been a long time since I did this sort of thing.
Topic archived. No new replies allowed.