Reposition a console window in C++


void RePositionWindow(int x, int y)
{
HWND windowHandle = GetConsoleWindow();
RECT rect;
GetWindowRect(windowHandle, &rect);
MoveWindow(windowHandle, x, y, rect.right - rect.left, rect.bottom - rect.top, true);
}