Im still a bit new to pointers and structs, and i dont understand why my display points function isnt working. Im thinking what im returning in readPoints isnt working right but it doesnt make much sense for the display to not work at all. Any suggestions would be greatly appriciated.
I know i need to make my own sorting function, i just dont understand how to sort points from a reference point. Would i need to determine the distance from refpoint with all the points then determine which distance is greater?
You will need a comparsion function which will return if first point is closer to reference point than second one. Then you can just pass comparsion function to std::sort alghorithm
You can make comparsion function in two ways:
1) if ref point is known at compile time, you can just hardcode it to your function.
2) Otherwise you should pass it as a parameter to your function and then bind real reference point to your function (as I done in my example).
3) Use lambdas.