// Travel.cpp (c) Kari Laitinen // http://www.naturalprogramming.com // 2000-11-07 File created. // 2002-12-10 Modification. // 2013-11-15 Last modification. /* To understand this program, you need to understand the basics of Earth's geometry. Angles are commonly measured in degrees. The ball surface of the Earth is divided horizontally into latitudes and vertically into longitudes which have certain angles in relation to the central point of the ball (the earth). To express angles more exactly, there are subunits "minute" and "second" in use. The following rules apply: - 1 degree is 60 minutes - 1 minute is 60 seconds Radian is a more mathematical unit of an angle. For example, 90 degrees is half of pi radians, and the full circle, 360 degrees, is two times pi radians. pi is approximately 3.14159 */ #include #include #include #include #include // class string etc. #include // class stringstream etc. #include using namespace std ; #include "useful_functions.h" #include "useful_functions_advanced.h" #include "class_text.h" #include "class_place_on_earth.h" #include "class_travel_application.h" int main( int number_of_command_line_arguments, char* command_line_arguments[] ) { Travel_application this_travel_application ; if ( number_of_command_line_arguments == 2 ) { string place_or_country = command_line_arguments[ 1 ] ; this_travel_application.search_place_or_country( place_or_country ) ; // MinGW C++ compiler did not accept the following call. // // this_travel_application.search_place_or_country( // string( command_line_arguments[ 1 ] ) ); // Similar problems existed also in some other places in this program. } else if ( number_of_command_line_arguments == 3 ) { string place_name = command_line_arguments[ 1 ] ; string country_name = command_line_arguments[ 2 ] ; this_travel_application.print_data_of_place_in_country( place_name, country_name ) ; } else if ( number_of_command_line_arguments == 4 ) { // The search functions behave so that they indicate // a successful search when they are given an empty string. string place_to_leave = command_line_arguments[ 1 ] ; string country_to_leave = command_line_arguments[ 2 ] ; string place_to_go_to = command_line_arguments[ 3 ] ; string country_to_go_to = "" ; this_travel_application.print_distance_between_places( place_to_leave, country_to_leave, place_to_go_to, country_to_go_to ) ; } else if ( number_of_command_line_arguments == 5 ) { string place_to_leave = command_line_arguments[ 1 ] ; string country_to_leave = command_line_arguments[ 2 ] ; string place_to_go_to = command_line_arguments[ 3 ] ; string country_to_go_to = command_line_arguments[ 4 ] ; this_travel_application.print_distance_between_places( place_to_leave, country_to_leave, place_to_go_to, country_to_go_to ) ; } else { this_travel_application.run() ; } }