Add distance to the Moon

master
Tomasz Golinski 2021-09-05 19:47:13 +02:00
rodzic c133eb70ca
commit c29f97546a
2 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -39,6 +39,7 @@ enum Status {
};
const int Earth_radius = 6378;
const int Moon_dist = 384400;
class Position {
public:

Wyświetl plik

@ -450,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) << "<br>";
tot_dist += cache_distance(*i->second, *std::next(i)->second);
}
std::cout << "Total distance between caches: <span class=\"value\">" << std::fixed << tot_dist << "</span> km (equivalent to <span class=\"value\">" << tot_dist / (2 * M_PI * Earth_radius) << "x</span> trips around Earth)<br>\n";
std::cout << "Total distance between caches: <span class=\"value\">" << std::fixed << tot_dist << "</span> km (equivalent to <span class=\"value\">" << tot_dist / (2 * M_PI * Earth_radius) << "x</span> trips around Earth or <span class=\"value\">" << tot_dist / Moon_dist << "x</span> trips to the Moon)<br>\n";
std::cout << std::resetiosflags(std::cout.flags());
if (sorted_fcaches.size() > 1)
std::cout << "Average distance between caches: <span class=\"value\">" << tot_dist / (sorted_fcaches.size() - 1) << "</span> km<br>\n";