title: How do I stop flickering in a console application?
body: <p>I made a simple Ping pong game in c++ through visual studio community(in windows). I made it, but the final product keeps flickering and it does not look good.</p>
  
  <p>I am new to c++. And this is one of the first big projects I tried making. Doing some research, I found out that I made a console app, and to stop the flicker, I will have to remake my app in Graphics, which I can't,so I am looking for a way to modify my console app to reduce flicker.</p>
  
  <p>My draw function-:</p>
  
  <pre><code> void Draw()
  {
      system("cls");
      for (int i = 0; i &lt; width + 2; i++)
          cout &lt;&lt; "\xB2";
      cout &lt;&lt; endl;
  
      for (int i = 0; i &lt; height; i++)
      {
          for (int j = 0; j &lt; width; j++)
          {
              int ballx = ball-&gt;getX();
              int bally = ball-&gt;getY();
              int player1x = player1-&gt;getX();
              int player2x = player2-&gt;getX();
              int player1y = player1-&gt;getY();
              int player2y = player2-&gt;getY();
  
              if (j == 0)
                  cout &lt;&lt; "\xB2";
  
              if (ballx == j &amp;&amp; bally == i)
                  cout &lt;&lt; "O";//ball
              else if (player1x == j &amp;&amp; player1y == i)
                  cout &lt;&lt; "\xDB";//player1_segment0
              else if (player2x == j &amp;&amp; player2y == i)
                  cout &lt;&lt; "\xDB";//player2_segment0
              /*Prints different segments of player1 in y-dir*/
              else if (player1x == j &amp;&amp; player1y + 1 == i)
                  cout &lt;&lt; "\xDB";//player1_segment1
              else if (player1x == j &amp;&amp; player1y + 2 == i)
                  cout &lt;&lt; "\xDB";//player1_segment2
              else if (player1x == j &amp;&amp; player1y + 3 == i)
                  cout &lt;&lt; "\xDB";//player1_segment3
              /*Prints different segments of player2 in y-dir*/
              else if (player2x == j &amp;&amp; player2y + 1 == i)
                  cout &lt;&lt; "\xDB";//player2_segment1
              else if (player2x == j &amp;&amp; player2y + 2 == i)
                  cout &lt;&lt; "\xDB";//player2_segment2
              else if (player2x == j &amp;&amp; player2y + 3 == i)
                  cout &lt;&lt; "\xDB";//player2_segment3
  
              else
                  cout &lt;&lt; " ";
  
              if (j == width - 1)
                  cout &lt;&lt; "\xB2";
          }
          cout &lt;&lt; endl;
      }
  
      for (int i = 0; i &lt; width + 2; i++)
          cout &lt;&lt; "\xB2";
      cout &lt;&lt; endl;
      cout &lt;&lt; "Score 1: " &lt;&lt; score1 &lt;&lt; endl;
      cout &lt;&lt; "Score 2: " &lt;&lt; score2 &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Thanks.</p>
  
  <p><a href="https://i.stack.imgur.com/E7v3y.png" rel="nofollow noreferrer">This is what it looks like without flickers</a></p>