I gave you the exact formula with the exact inputs:
int turn(double curN, double curE, double targetN, double targetE, double curHeading) {
double target = atan2(targetN - curN, targetE - curE) * 180 / M_PI;
double delta = curHeading - target;
if (delta > 180) delta -= 360;
if (delta < -180) delta += 360;
if (delta < -2) return -1; // turn left
if (delta > 2) return 1; // turn right
return 0; // go straight
}
If you don't know how to call a function like this, then you're obviously going to fail your current task. If that's the case, I think the best thing for you would be to go back a step or two and learn C/C++ programming first, and only start doing more advanced things like autonomous navigation once you have a clear grasp of that necessary pre-requisite.
Moderator edit: Fixed tags. (Nick Gammon)