title: Freeze the output screen for a certain amount of time in c++
body: <p>I've been trying to make a snake game in c++. While making the snake move I want the snake to be frozen to its position for 1 second and then print the new position.
  I made the following function for that:</p>
  
  <pre><code>void wait_time(int wait_t){
          time_t curr=time(NULL);
          time_t nav_t=time(NULL);
          while(1){
              if (nav_t-curr==wait_t) {
                  break;
              }
              else{
                  nav_t=time(NULL);
              }
          }
  }
  </code></pre>
  
  <p>But while this function is being executed my previous output doesn't stay. A part of the output is removed. This my main function that controls all functions:</p>
  
  <pre><code>void run_game(){
      initial=time(NULL);
      inital_parameter();
      gotoxy(0,2);
      game_display();
      wait_time(1);
      game_movement();location_disp();
      game_display();
      gotoxy(0,100);
  }
  </code></pre>