I had to create a program which calculates the shortest distance between to coordinates on earth's surface that the user inputs. The formula contains a lot of sin and cos functions which only accept radians and my professor wants the user to input the degrees and he wants me to convert the degrees the user inputs to radians from the source code. How can i do this without multiplying every degree the user inputs by (pi/180) in the formula??
here is what my source code looks like:
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<iomanip>
using namespace std;
int main()
{
cout <<"Enter the latitude of point 1: ";
double a;
cin >>a;
cout <<"Enter the longtitude of point 1: ";
double b;
cin >>b;
cout <<"Enter the latitude of point 2: ";
double e;
cin >>e;
cout <<"Enter the longitude of point 2: ";
double f;
cin >>f;
double r=3959.87; double q=acos(1.0*sin(a)*sin(e)+cos(a)*cos(e)*cos(b-f));//this is where the degrees have to be converted to radians
double d=r*q;