title: How to Show the X,Y co-ords upon click and show in console
body: <p>I've been learning c++ for over two weeks now and I'm trying to put what knowledge I have to practice by writing a simple console application that shows the X &amp; Y co-ordinates of my mouse cursor, I have looked at the MSDN Libs and tried making sense, but all I have managed to do is show the co-ords but in the wrong way.</p>
  
  <p>Here is the code I have now, it's not a lot but I want to make sure I'm doing things in the right way so I don't pick up bad habits;</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;Windows.h&gt;
  
  int main() 
  {
  POINT cursorPos;
  GetCursorPos(&amp;cursorPos);
  printf("X %d    Y %d\n", cursorPos.x, cursorPos.y);
  
  
  system("PAUSE");
  }
  </code></pre>
  
  <p>The main goal of this is to have the console open (once run) and listening for left clicks and then displaying that Co-ord in the console until its clicked again!</p>
  
  <p>Any help on this would be much appreciated, and sorry if this has been posted somewhere before I have tried searching but had no luck!</p>
  
  <p>Regards</p>
  
  <p>Chris</p>