title: gotoxy() user defined function in c++
body: <p>i have read in my course that gotxy() is a predefined function but it is not working on Microsoft visual 2013.so I do some search and i got that piece of code which work will but i have to understand it.So can any one explain it in detail. </p>
  
  <pre><code>void gotoxy(int x, int y)
  {
  HANDLE hConsoleOutput;
  COORD dwCursorPosition;
  
  cout.flush();
  dwCursorPosition.X = x;
  dwCursorPosition.Y = y;
  hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
  SetConsoleCursorPosition(hConsoleOutput, dwCursorPosition);
  }
  </code></pre>