diff --git a/cache.h b/cache.h index 443db07..2a76a46 100644 --- a/cache.h +++ b/cache.h @@ -39,7 +39,6 @@ enum Status { }; const int Earth_radius = 6378; -const double Pi = 3.14159265358979323846264338327950288; class Position { public: diff --git a/geostat.cpp b/geostat.cpp index 95fd2a1..7254b3a 100644 --- a/geostat.cpp +++ b/geostat.cpp @@ -12,6 +12,7 @@ #include #include #include +#include void show_usage() { std::cout << "Usage: geostat [options]\n"; @@ -449,7 +450,7 @@ int main(int argc, char** argv) { //std::cout << "Distance between " << i->second->name << " and " << std::next(i)->second->name << " is " << cache_distance(*i->second, *std::next(i)->second) << "
"; tot_dist += cache_distance(*i->second, *std::next(i)->second); } - std::cout << "Total distance between caches: " << std::fixed << tot_dist << " km (equivalent to " << tot_dist / (2 * Pi * Earth_radius) << "x trips around Earth)
\n"; + std::cout << "Total distance between caches: " << std::fixed << tot_dist << " km (equivalent to " << tot_dist / (2 * M_PI * Earth_radius) << "x trips around Earth)
\n"; std::cout << std::resetiosflags(std::cout.flags()); if (sorted_fcaches.size() > 1) std::cout << "Average distance between caches: " << tot_dist / (sorted_fcaches.size() - 1) << " km
\n";