Clearing the Console in C++
<p>I am trying to clear the console in C++. I know printing a number of newlines is a bad practice, as it can be slow and is not always reliable to completely clear the console window, but I have researched multiple options and have found almost no other solutions besides <code>system("cls")</code>, which is an even worse option.</p>

<p>Essentially, I have used the line <code>cout &lt;&lt; string(100, '\n');</code> but I am getting a near-unidentifiable error when I try to run the program.</p>

<p><code>error C2679: binary '&lt;&lt;' : no operator found which takes a right-hand operand of type 'std::basic_string&lt;_Elem,_Traits,_Ax&gt;' (or there is no acceptable conversion)</code></p>

<p>I have also researched this, and found that most explanations were too complicated for me as a beginning C++ programmer to understand, or completely unrelated to my problem.</p>

<p><strong>My questions are (1) is there a way to fix this error, and (2) could there be a better, cross-platform way of clearing the console other than printing 100 newlines?</strong></p>

<p>I also heard of <code>Console.clear()</code>, but I'm unsure if this is cross-platform. From what I've seen, it looks more like a Windows command. I've also heard of the <code>curses</code> library, which I was willing to research and use, until I read somewhere that it was not recommended to use the functions which I am familiar with coupled with the curses library functions.</p>

<p>Thank you in advance!</p>
