I am trying to figure out why my function isn't working when I compile the program....can anyone suggest anything?
#include <iostream>
#include <cmath>
using namespace std;
double distance();
void main()
{
double center1, center2, point1, point2;
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();
cout << endl;
} //End of Main
double distance()
{
double center1, center2, point1, point2;
double distance1, distance2, distance3;
if (point1 >= center1 && point2 >= center2 )
distance1 = (point1 - center1);
distance2 = (point2 - center2);
distance3 = pow((distance1 + distance2), (1/2));
cout << "Distance Between Points: " << distance3;
else
cout << "Points Will Produce an Unreal Number";
cout <<endl;
return distance3;
}