The program pops up but then i get an error saying y2 is being used without being initialized. But i can't find it. If you find any other errors please tell me.
Code:
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double distance(double x1, double y1, double x2, double y2);
double radius(double x1, double y1, double x2, double y2);
double diameter(double rad);
double circumference(double rad);
double area(double rad);
const double Pi = 3.1416;
int main()
{
double origin1, origin2, pt1, pt2, x1, x2, y1, y2, rad;
rad = (x1,y1,x2,y2);
cout << setprecision(2) << fixed << showpoint;
cout << "Please input the origin of your circle" << endl;
cin >> origin1 >> origin2;
cout << "Please input a point on the circle" << endl;
cin >> pt1 >> pt2;
cout << "Your origin is: " << "(" << origin1 << "," << origin2 << ")" << endl;
cout << "Your point is: " << "(" << pt1 << "," << pt2 << ")" << endl;
cout << "The distance between the point and the origin is"
<< distance(pt1, origin1, pt2, origin2) << endl;
cout << "The radius of your circle is: "
<< radius(pt1, origin1, pt2, origin2) << endl;
cout << "The diameter of your circle is: " << diameter(rad) << endl;
cout << "The circumference of your circle is: "
<< circumference(rad) << endl;
cout << "The area of your circle is: " << area(rad) << endl;
return 0;
}
double distance(double x1, double y1, double x2, double y2)
{
return sqrt(pow(x1-y1,2) + pow(x2-y2,2));
}
double radius(double x1, double y1, double x2, double y2)
{
return distance(x1, y1, x2, y2);
}
double diameter(double rad)
{
return 2 * rad;
}
double circumference(double rad)
{
return Pi * rad;
}
double area(double rad)
{
return pow(rad, 2);
}