Question: mplete the following program that can calculate the direction from Greensboro to any point on be. You will have to convert the math equations to

mplete the following program that can calculate the direction from Greensboro to any point on be. You will have to convert the math equations to their proper C++ format. Note that atan2 thod of the cmath library that takes two parameters separated by a comma. Calculate the direction to any place on the earth. */ your name here / nclude nolude ing namespace std; t main () I double PI =3.141592653589793; / Declare two doubles, degrees and minutes, to hold the input. */ / Declare, latitude, longitude and direction to hold the destination and result */ / Declare two doubles, longDif and cosLat, to hold temporary values */ /* Declare gboroLat and gboroLong and set them to 0.629482084 and 1.36513836/ / Ask the user to enter the degrees and minutes of the destination longitude */ / Read degrees and minutes */ /* Calculate longitude =( degrees +60minutes)180 */ / Ask the user to enter the degrees and minutes of the destination latitude */ / Read degrees and minutes */ F Calculate latitude =( degrees +60minutes)180/ /* Set longDif to longitude minus gboroLong */ /* Set cosLat to the cosine of the latitude */ / Calculate direction =atan2(sin( longDif) cos Lat, cos( gboroLat ) sin( latitude ) sin( gboroLat) * cos Lat * cos( longDif) ) / / Convert the direction in radians to degrees by degrees = direction 180/ / Display the direction in degrees / Some interesting locations Sample input and output: Enter destination longitude in degrees and minutes 3948 Enter destination latitude in degrees and minutes 2125 The direction is 56.0834 degrees
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
