C++ functions to convert between decimal degrees and degrees, minutes, and seconds

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:


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.