LastNameFirstName_HW2.cpp

# LastNameFirstName_HW2.cpp - Calculating distance program...

• 2

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

/* 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=====================================";

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

This is the end of the preview. Sign up to access the rest of the document.
• Fall '13
• ClareNguyen

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern