title: How to pause a loop in C/C++
body: <p>I am trying to make a screen for a car game and make the screen wait for a key to go into the next screen, thing is that with this code it changes colors too fast. I've already tried <code>delay()</code> and <code>sleep()</code> which haven't worked properly. Also, after hitting a key, it closes and doesn't wait for me to enter a key. I just want the title to blink between white and red until a key is hit, and get to know why it exits after hitting a key.</p>
  
  <p>Here is my code: </p>
  
  <pre><code>#include &lt;dos.h&gt;
  #include &lt;graphics.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;conio.h&gt;
  
  int main(void)
  {
      int gdriver = DETECT, gmode, errorcode;
      initgraph(&amp;gdriver, &amp;gmode, "C|\\BORLANDC\\BGI");
      outtextxy(250,280,"POINTER DRIVER 1.0");
      outtextxy(250,290,"LCCM 10070249");
      do
      {
          setcolor(WHITE);
          outtextxy(250,380,"PRESS ANY KEY TO CONTINUE");
          // delay(10); nothing works here :(
          setcolor(RED);
          outtextxy(250,380,"PRESS ANY KEY TO CONTINUE");
      } while(!kbhit());
      cleardevice();
      outtextxy(250,290,"HELLO"); //here it draws mega fast and then exits
      getch();
      closegraph();
      return 0;
  }
  </code></pre>