title: Clear Screen using C++
body: <p>I would like to clear the CMD screen. I have seen a few options. First is</p>
  <pre><code>system(&quot;cls&quot;);  
  </code></pre>
  <p>but I don't want to use system, cause then it makes it dependent on Windows. Same with the Unix version.</p>
  <p>If I try</p>
  <pre><code>cout &lt;&lt; string(22, '\n');
  </code></pre>
  <p>then my next line of text is at the bottom of the screen and I want it at the top. How can I clear the screen and get the text back to the top of the screen?</p>
  <p>Thus say I have this:</p>
  <pre><code>cout &lt;&lt; string(22, '\n');
  cout &lt;&lt; &quot;************Question 1 *******&quot; &lt;&lt; endl;
  cout &lt;&lt; &quot;WHO WAS THE FIRST BLACK PRESEDENT?&quot; &lt;&lt; endl;
  cout &lt;&lt; &quot;(1) Obama&quot; &lt;&lt; endl;
  cout &lt;&lt; &quot;(2) Bush&quot; &lt;&lt; endl;
  cout &lt;&lt; &quot;(3) Jordan&quot; &lt;&lt; endl;
  cin &gt;&gt; answer &gt;&gt; endl;
  </code></pre>
  <p>This will clear the screen then put mymenu at the bottom of the screen... How can I make it clear the screen and put the question/answers back up top of the screen?</p>