title: How to clear console in windows using c++?
body: <p>I was wondering how to clear the console in c++.</p>
  <p>I tried:</p>
  <pre><code>cout &lt;&lt; &quot;\x1B[2J\x1B[H&quot;;
  </code></pre>
  <p>and</p>
  <pre><code>system(&quot;cls&quot;);
  </code></pre>
  <p>The first option seemed to work on my computer but it didn't work on my friend's computer.
  The second option worked but many people recommended me not to use it because of many reasons.
  There is also a third option which is to print lots of new lines but that method is janky.
  Are there any other solutions to this?
  I have tried searching for solutions on here but most posts are from 10 years ago.</p>