So I posed this question earlier but maybe I didn't explain it well enough. Basically, I have a txt file with pairs of coordinates for different locations. The first column has latitudes and the second longitudes. It looks a bit like this:
23.64 78.98
21.34 34.67
21.11 57.52
and so on and so on.. Basically, what I need to do is assign a variable for each latitude and longitude (separately) so that later on, I'll be able perform distance calculations with them. How could I pull the data from this txt (titled coordinates.txt) to c++, and make it so that the variable a1, for example, equals 23.64, a2 = 78.98, b1 = 21.34 etc. I don't really care what the variables will be called, just need there to be a variable for each number. I'm quite inexperienced in c++ and have little time to learn it so any help would be greatly appreciated.
for (Coordinates::iterator it = coordinates.begin(); it != coordinates.end; ++it)
{
it->lat; // This is the latitude
it->lon; // This is the longitude
}
I keep getting an error in the 1st line of the accessing. Maybe I'm not putting this in the right place, what would this whole code look like? Seriously, I just started c++ a few days ago so this is all very new. Thanks