Ok, I am sorry but this is a beginners program and I need serious help. First of all I am trying to use User-Defined function I. I am trying to find the radius, diameter, circumference, and area of a circle. I know my code is messed up and I need help, please. I am getting errors in my int main() where radius: this statement doesn’t take 4 arguments, circumference: this statement doesn’t take 1 argument, and diameter: this statement doesn’t take 1 argument. Also I would like to know how to get the symbol for pie on the keyboard and the initialize it “globally”. Please Help
Code:
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double radius(double x, double y, double w, double z);
double diameter(double x);
double circumference(double x);
double area(double x);
const char p = 3.1416;
int main()
{
double orgin1, orgin2, pt1, pt2, radius, diameter, circumference;
cout << setprecision(2) << fixed << showpoint;
cout << "Please input the origin of your circle" << endl;
cin >> orgin1 >> orgin2;
cout << "Please input a point on the circle" << endl;
cin >> pt1 >> pt2;
cout << "Your origin is: " << "(" << orgin1 << "," << orgin2 << ")" << endl;
cout << "Your point is: " << "(" << pt1 << "," << pt2 << ")" << endl;
cout << "The radius of your circle is: "
<< radius(pt1, orgin1, pt2, orgin2) << endl;
cout << "The diameter of your circle is: " << diameter(radius) << endl;
cout << "The circumference of your circle is: "
<< circumference(diameter) << endl;
cout << "The area of your circle is: " << area(radius) << endl;
return 0;
}
double radius(double x, double y, double w, double z)
{
double radius, sum;
x = pow(x-y,2);
w = pow(w-z,2);
sum = x + w;
radius = sqrt(sum);
return radius;
}
double diameter(double x)
{
double diameter;
diameter = 2 * x;
return diameter;
}
double circumference(double x)
{
double cicumference;
circumference = p * x;
return circumference;
}
double area(double x)
{
double area;
x = pow(radius, 2);
area = p * x;
return area;
}