Pages

💡 Now You Can Get your Assignments Sollution here... .💡 100% plagiarism Free Service...💡 Responsibility, punctuality and on-time delivery... 💡 Furnishing you with experts... 💡 experienced in your subject 100% privacy... 💡 helping you with the highest efficiency , professionalism Affordable and budget-friendly costs that do not make a hole in your wallet

Circumference and Center of Circle

#include<iostream>
#include<math.h>
float circumference(float,float);
float radius(float,float);
float distance(float,float,float,float);
float area(float,float);
const double p=3.1416;
using namespace std;
void main()
{
float x1,x2,y1,y2;
cout<<"Enter first points of circle:\n";
cin>>x1>>x2;
cout<<"Enter second points of circle:\n";
cin>>y1>>y2;
cout<<"distance of circle is:"<<distance(x1,x2,y1,y2);
cout<<"radius of circle is:"<<radius(x1,x2);
cout<<"circumference of circle is:"<<circumference(x1,x2);
cout<<"area of circle is :"<<area(x1,x2);

}
float distance(float x1,float x2,float y1,float y2)
{
float ans;
float p1,p2;
p1=x2-x1;
p2=y2-y1;

p1=pow(p1,2);
p2=pow(p2,2);

ans=p1+p2;
return sqrt(ans);
}
float radius(float x1,float x2)
{
//using formula [(x-h)^2+(y-k)^2]=r^2
float h,k;
float ans;
float p1,p2;
cout<<"Enter center of circle:";
cin>>h,k;
p1=x1-h;
p2=x2-h;

p1=pow(p1,2);
p2=pow(p2,2);

ans=p1+p2;
return sqrt(ans);

}
float circumference(float x1,float x2)
{
float r=radius(x1,x2);
float ans=2*p*r;
cout<<ans;
return ans;
}
float area(float x1,float x2)
{
return pow((p*(radius(x1,x2))),2);
}

No comments: