title: C++ how do I terminate my programm using ESC button
body: <p>Here is my main function i use visual studio 2012 express and the code works fine. My question is how will i terminate this loop when the user Presses the ESC button instead of -1. Although i would prefer a solution that works both in unix and windows, if it is not possible i am most interested in it working for windows.</p>
  
  <pre><code>int _tmain(int argc, _TCHAR* argv[])
  {
  list mylist;
  
  int value;
  cout&lt;&lt;"Give the numbers you want to insert to the list, press -1 to stop\n";
  do
  {
      cin&gt;&gt;value;
      mylist.insertf(value);
      mylist.sort_list();
      mylist.print();
  }while(value!=-1);
  
  
  
  
  }
  </code></pre>