LastNameFirstName_HW2.cpp

LastNameFirstName_HW2.cpp - Calculating distance program...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/* Calculating distance program This program asks for input of the latitude and longtitde of home and the store and calculate the distance by using the Havesine formula. The distance is displayed in miles and kilometers. */ #include <iostream> #include <iomanip> #include <cmath> #include <string> using namespace std; void idFunction(); const int RADIUS = 3959; //earth's radius const double DEG_RADIAN = 57.2957795; //degree to radian conversion const double MILE_KILO = 8.0/5.0; //miles to kilometers conversion int main() { // variable declaration string address; //home address double latStore; //latitude of store double longStore; //longitude of store double latHome; //latitude of home double longHome; //longitude of home double deltaLat; //difference in latitude double deltaLong; //difference in longitute double cal1; //first part of calculation double cal2; //second part of calculaton double distanceMile, distanceKilo; //distance in miles and kilometers idFunction(); //Ask for input cout << "Enter store address: "; getline(cin, address); cout << "Enter latitude and longitude of store (sep. by a space): "; cin >> latStore >> longStore; cout << "Enter latitude and longitude of home (sep. by a space): "; cin >> latHome >> longHome ; cout << "\n=====================================";
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern