I’ve run into situations where it was necessary to convert decimal degrees to degrees, minutes, and seconds.
Here’s a couple of C++ functions which handle the conversion between these two formats:
std::string DegreesMinutesSeconds(double ang) ; double DecimalDegrees(const std::string& dms) ;
These are inline functions defined in the header file, dms.h: