Nov 24, 2008 at 7:07am UTC
guys i really have big problem
i need some one make this program work correctly
because our doctor want it today
#include <iostream>
#include <cmath>
using namespace std;
double finddistance (int x1,int x2,int y1,int y2)
{
double distance;
distance= pow((x2-x1),2) + pow((y2-y1),2);
distance= sqrt(distance);
return (distance);
}
double findr (int x1,int x2,int y1,int y2)
{
double r;
r= pow((x2-x1),2) + pow((y2-y1),2);
r= sqrt(r);
return (r);
}
double findcf (double r)
{
double cf;
cf=2*r*3.1416;
return (cf);
}
double findarea (double r)
{
double area;
area= pow(r,2) * 3.1416;
return (area);
}
int main()
{
int x1,x2,y1,y2;
double r;
cout<<"Enter the center point (X1,Y1)"<<endl;
cin>>x1>>y1;
cout<<"Enter any point on the circle (X2,Y2)"<<endl;
cin>>x2>>y2;
cout<<"The Distance ="<<" "<<finddistance (x1,x2,y1,y2)<<endl;
cout<<"The Radius ="<<" "<<findr (x1,x2,y1,y2)<<endl;
cout<<"The Diameter ="<<" "<<findr (x1,x2,y1,y2) * 2<<endl;
cout<<"The Circumference ="<<" "<<findcf (r)<<endl;
cout<<"The Area ="<<" "<<findarea (r)<<endl;
return 0;
}
and thanks in advance
Last edited on Nov 24, 2008 at 8:37am UTC
Nov 24, 2008 at 1:33pm UTC
You should say the errors you get (
http://www.cplusplus.com/forum/articles/1295/ )
and use
[ code
] [ /code
] tags
to solve ambiguity for
pow :
pow((x2-x1),2.0)
cout<<"The Radius =" <<" " <<findr (x1,x2,y1,y2)<<endl;
does not set the variable
r (after called in
findcf and
findarea ) to have the value of the radius
Last edited on Nov 24, 2008 at 1:34pm UTC