title: How to break the loop using user input?
body: <p>I am trying something like this.Its counting down seconds from 5-1.</p>
  
  <pre><code> #include&lt;iostream&gt;
   #include&lt;stdlib.h&gt;
   #include&lt;windows.h&gt;
   #include&lt;iomanip&gt;
   using namespace std;
  
   int main()
   {
      for(int i=5;i&gt;0;i--)
    {
     cout&lt;&lt;"\n\n\n\n\n\n";
     cout&lt;&lt;setw(35);
     cout&lt;&lt;i;
     Sleep(1000);
     system("CLS");
    }
    system("PAUSE");
  }
  </code></pre>
  
  <p>And i trying to figure out a way to break the loop using a user input(from keyboard) to break it while its running. I have no idea about how to do this.I have heard about multi-threading. I don't even know if multi-threading has any application in my situation or not .So any ideas on how to break it in middle while its executing the loop?</p>