Ok so i am building a beginners program, to have a user input the center of a circle and then a point and find the radius, diameter, area, and circumference. I am suppose to use predefined functions and value returning functions. I put the error of what the compiler said on the line it had a problem with using comments please help if you can.
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 double 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;// term doesn't evaluate 4arguements cout << "The diameter of your circle is: " << diameter(radius) << endl;// term cout << "The circumference of your circle is: " // doesn't evaluate 1 arguement << circumference(diameter) << endl; // term doesn't evaluate 1 argument 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; // cannot convert from double to double } double area(double x) { double area; x = pow(radius, 2); // none of the 7 overloads can convert parameter 1 from area = p * x; // type double return area; }



LinkBack URL
About LinkBacks


