Answer:
Explanation:
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
//this function reads the cooridnates of Center from the user
//parameteres are pointer variables of Cx,Cy
//it does not return anything and stores coordinates at given addresses of Cx,Cy
void readCenter(int *Cx,int *Cy)
{
string cooridnates;
cout << "Enter the x and y cooridnates of the centre of the circle separated by comma: " ;
getline(cin,cooridnates);//reading inputs
//convering string ot integer
string x = cooridnates.substr(0, cooridnates.find(","));
string y = cooridnates.substr(cooridnates.find(",")+1);
*Cx=stoi(x);
*Cy=stoi(y);
}
//this function reads the cooridnates of Point from the user
//parameteres are pointer variables of Px,Py
//it does not return anything and stores coordinates at given addresses of Px,Py
void readPoint(int *Px,int *Py)
{
string cooridnates;
cout << "Enter the x and y cooridnates of a point on the circle separated by comma: " ;
getline(cin,cooridnates);//reading inputs
//convering string ot integer
string x = cooridnates.substr(0, cooridnates.find(","));
string y = cooridnates.substr(cooridnates.find(",")+1);
*Px=stoi(x);
*Py=stoi(y);
}
double findArea(double radius)
{
double pi=acos(-1);
return pi*pow(radius,2);
}
double findCircum(double radius)
{
double pi=acos(-1);
return 2*pi*radius;
}
int main()
{
int Cx,Cy;
int Px,Py;
readCenter(&Px,&Py);
readPoint(&Cx,&Cy);
double radius=sqrt(pow((Px-Cx),2)+pow((Py-Cy),2));
cout<<"The circle has an area of "<<findArea(radius)<<" sqaure units\n";
cout<<"The circle has a Circumference of "<<findCircum(radius)<<" units";
return 0;
}