How can I call a value that was created in 1 function into another function so that it can be used as a variable? (i.e how do I implement the values that I found in my distance function, and use them in my radius function...)
#include <iostream>
#include <cmath>
using namespace std;
double distance(double center1, double center2, double point1, double point2);
double radius(double distance3);
int main()
{
double center1, center2, point1, point2, distance3;
cout << "Please Enter X-Value of Center: ";
cin >> center1;
cout << "Please Enter Y-Value of Center: ";
cin >> center2;
cout << endl;
cout << "Please Enter X-Value of Point: ";
cin >> point1;
cout << "Please Enter Y-Value of Point: ";
cin >> point2;
cout << endl;
cout << "Distance between Points: " << distance(center1,center2,point1,point2);
cout << endl;
cout << "Radius: " << radius(distance3);
cout << endl;
} //End of Main
double distance(double center1, double center2, double point1, double point2)
{
double distance1, distance2, distance3;
distance1 = pow((point1 - center1), 2);
distance2 = pow((point2 - center2), 2);
distance3 = pow((distance1 + distance2), 0.5);
return distance3;
}
double radius(double distance3)
{
double rad;
rad = distance3 / 2;
return rad;
}