New to C++, i'm sure i have included libraries that i don't need however i am trying to convert radians, to degrees decimal, to DMS and display the result.
The problem is,
The minutes value is half of what it should be in output,
The seconds value is in the thousands when it should be [0-59].
Consider doing the calculations to min and second with double first, then convert to unsigned int afterwards (if required) . Line 48 does integer division, and this messes up your calc. I always write double numbers with digits either side of the decimal point, it forces a double calculation, avoid integer division.
Also need some logic to cover when min or sec is near to 60.0. Consider your bearing is 359d59'59.6" , this should result in 0d00'00" obviously, but at the moment you might get 359d60'60"
Can also use the floor function, C++ has overloads so this will work with double.
Should use the atan2 function, then you can get the correct quadrant for your bearing. atan gives a result +/- 90 degrees
The pow function is generally inefficient for squaring numbers (it probably uses a binomial expansion or some other technique to do it) so it's easier to just multiply the number with itself. I would work out the delta (EAST or NORTH) and square that.
To be pedantic, an Easting is a delta EAST, a lot of people call total coordinates Easting / Northing when they really mean EAST / NORTH. In the old days our traverse tables had Easting, Westing, Northing and Southing, then EAST NORTH
180.0/M_PI is a constant value, so you could express that in the code:
constexprdouble RadianToDegree = 180.0/M_PI; // C++11, use const otherwise