#include <cstdlib>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cctype>
using namespace std;
double distance(double,double,double,double);
double radius(double,double,double,double,double);
int main()
{double X,secX,Y,secY,z,r;
r=0;
cout<< "Please enter the x value of the center of the circle:"<< endl;
cin>>secX;
cout<< "Please enter the y value of the center of the circle:" << endl;
cin>>secY;
cout<< "Please enter the x value of a point on the circle:"<<endl;
cin>>X;
cout<< "please enter the y of said point:"<< endl;
cin>>Y;
cout << "number before being taking square root:"<<pow(X-secX,2)+pow(Y-secY,2)<< endl;
cout <<radius(r,X,Y,secX,secY)<< endl;
system("PAUSE");
return EXIT_SUCCESS;
}
double distance(double X,double Y,double secX,double secY)
{
cout << fixed << showpoint <<setprecision(2)<< sqrt(pow(X-secX,2)+pow(Y-secY,2));
}
double radius(double r,double X,double Y,double secX,double secY)
{ r = double distance( X, Y, secX, secY);
cout<<"radius is = "<< fixed << showpoint <<setprecision(2)<<r<<endl;
}
I m trying to get one function to use a value from another all the while out putting numbers that show the decimal place instead of an exponent value.
What am I doing wrong? I can get one function to work but as soon as I try to format the second it doesnt work anymore...