I have a datafile consisting of three columns (x, y, z). I would like to compare each set of (x,y), if they are equal within the range of (x±0.9, y ± 0.9) then I'd like to compare the two z columns. If any z is outside the range (117.5-118.5 && 122.5-128.5) then I'd like the z outside this range and the associated x,y to be omitted from the data. If the two z values lie within this range, then I would like the one closer to (125.3 ± 0.6) to be kept in the file, while the other point to be omitted.
Finally and more importantly, I'd like the source code in C/C++ for this somewhat straightforward task. Payment will be made after receiving and testing this.