Code:

```
// Calling code
getLatLonDist distance(0.592539, 0.709186, 2.066470, 1.287762);
// Class
class getLatLonDist
{
double lat1, lat2, lon1, lon2;
public:
getLatLonDist(double, double, double, double);
double distance = 0;
double calc_distance(double latA, double latB, double lonA, double lonB)
{
double dlon, dlat;
lat1 = latA;
lat2 = latB;
lon1 = lonA;
lon2 = lonB;
dlat = lat2 - lat1;
dlon = lon2 - lon1;
distance = acos(sin(lat1)*sin(lat2) + cos(lat1)*cos(lat2)*cos(lon1 - lon2));
return distance;
}
};
getLatLonDist::getLatLonDist(double latitudeA, double latitudeB, double longitudeA, double longitudeB)
{
lat1 = latitudeA;
lat2 = latitudeB;
lon1 = longitudeA;
lon2 = longitudeB;
}
```