[highlight=c++]#include <iostream>
#include <Windows.h>
void main()
{
while (true)
{
if(GetAsyncKeyState(VK_LBUTTON))
{
int x = 50;
int y = 60;
SetCursorPos(x ,y);
}
}
}[/highlight]
You use the GetAsyncKeyState function to check whether the Left Button is down, if so, you simply set the cursor position specified by x and y parameters. Both these functions reside in Windows.h header file.