0

I am working with code that returns 2 doubles into an auto named "coordinate". I am inexperienced with with the auto type and all I am trying to do is get the data into "normal" variables that I could work with as I desire. Here is what I am working with :

auto coordinate = CoordinateToCoordinate(lat, lon, angle, dist); 

The return is always something like "29.29324, -101.43932". How do I get each double into a variable I can work with?

It would be perfect to place them into 2 names like the ones below. After reading online and here I have been unable to find anything that (atleast on my skill level) is enough to help me understand how to even start.

double latitude;
double longitude;

Edit : This is most of the code where I am having trouble understanding - most of it is beyond my understanding, though I am trying.

std::pair<double,double> CoordinateToCoordinate (double latitude,
                                                 double longitude,
                                                 double angle,
                                                 double meters)
{
  latitude = degreeToRadian(latitude);
  longitude = degreeToRadian(longitude);
  angle = degreeToRadian(angle);
  meters *= 2 / earthDiameterMeters;

  using namespace std;
  pair<double,double> coordinate;

  coordinate.first = asin((sin(latitude) * cos(meters))
                        + (cos(latitude) * sin(meters) * cos(angle)));
  coordinate.second = longitude + atan2((sin(angle) * sin(meters) * cos(latitude)),
                                        cos(meters) - (sin(latitude) * sin(coordinate.first)));

  coordinate.first = radianToDegree(coordinate.first);
  coordinate.second = radianToDegree(coordinate.second);

  return coordinate;
}
David
  • 605
  • 2
  • 14
  • 44

0 Answers0