I am making a program to calculate the distance between 2 location by inputting the latitude and longitude of the locations using DMS, then convert the given DMS to angular measurement. I have made the program using functions but when it finally calculate for the distance, it always goes to zero. Need help on using reference or pointer right because I believe I'm not using it right.

This is the program. it is kind of long so please bear with me.

```
#include <cmath>
#include <iostream>
using namespace std;
void Latitude(int, int, int, char, double&);
void Longitude(int, int, int, char, double&);
double const Pi = acos(-1.0);
int main()
{
int degrees[4], minutes[4], seconds[4];
char direction[4];
double Alpha[2], Beta[2], R = 3958.89, theta, distance, temp[2], alpha, beta;
cout << "\nThis program will estimate the distance between two"
<< "\npoints on the earth when location is input by"
<< "\nLatitude and Longitude." << endl ;
cout << "\nEnter the Latitude - degrees, minutes, seconds and first letter of the"
<< "\ndirection (ex. N for north) (From)" << endl;
cin >> degrees[0]
>> minutes[0]
>> seconds[0]
>> direction[0];
cout << "\nNow enter the Longitude "
<< " (From)" << endl;
cin >> degrees[1]
>> minutes[1]
>> seconds[1]
>> direction[1];
cout << "\nEnter the Latitude "
<< " (To)" << endl;
cin >> degrees[2]
>> minutes[2]
>> seconds[2]
>> direction[2];
cout << "\nNow enter the Longitude "
<< " (To)" << endl;
cin >> degrees[3]
>> minutes[3]
>> seconds[3]
>> direction[3];
//------------------------Calls Function
cout << "\n\t From"<< endl ;
cout << "----------------------------------" << endl ;
Latitude(degrees[0], minutes[0], seconds[0], direction[0], alpha);
Longitude(degrees[1], minutes[1], seconds[1], direction[1], beta);
cout << "\n---------------------------------" << endl ;
Alpha[0] = alpha;
Beta[0] = beta;
cout << "\n\n\t To" << endl ;
cout << "-----------------------------------" << endl ;
Latitude(degrees[2], minutes[2], seconds[2], direction[2], alpha);
Longitude(degrees[3], minutes[3], seconds[3], direction[3], beta);
cout << "\n---------------------------------" << endl ;
Alpha[1] = alpha;
Beta[1] = beta;
//-------------------------Formula to find distance
temp[0] = cos(Alpha[0]*180.0/Pi)*cos(Alpha[0]*180.0/Pi);
temp[1] = sin(Alpha[0]*180.0/Pi)*sin(Alpha[0]*180.0/Pi)*cos(Beta[0]*180.0/Pi-Beta[1]*180.0/Pi);
theta = acos(temp[0]+temp[1]);
distance = R * theta;
cout << "\n\nThe Distance between the two coordinates are " << distance << " miles" << endl << endl ;
system("pause");
return 0;
}
//-----------------------FUNCTIONS-------------------------------
void Latitude(int degrees, int minutes, int seconds, char direction, double& alpha )
{
double new_degrees, alp;
if (direction == 'N' || direction == 'n')
{
new_degrees = degrees + (minutes / 60.0)
+ (seconds / 6.00 / 60.0 );
alp = 90.0 - new_degrees;
cout << "\nAngular Measurement : " << new_degrees << " N";
}
else if (direction == 'S' || direction == 's')
{
new_degrees = degrees + (minutes / 60.0)
+ (seconds / 60.0 / 60.0 );
alp = 90.0 + new_degrees;
cout << "\nAngular Measurement : " << new_degrees << " S";
}
else
cout << "\nInvalid Direction";
}
void Longitude(int degrees, int minutes, int seconds, char direction, double& beta)
{
double new_degrees, bet;
if (direction == 'W' || direction == 'w')
{
new_degrees = degrees + (minutes / 60.0)
+ (seconds / 60.0 / 60.0 );
cout << "\nAngular Measurement : " << new_degrees << " W";
beta = new_degrees;
}
else if (direction == 'E' || direction == 'e')
{
new_degrees = degrees + (minutes / 60.0)
+ (seconds / 60.0 / 60.0 );
beta = 360.0 - new_degrees;
cout << "\nAngular Measurement : " << new_degrees << " E";
}
else
cout << "\nInvalid Direction";
}
//-------------------------------------------------------------------------
```