Hello everyone I post last night with this same code, and I got a lot of advice. But there are 3 more errors that persist after I changed the code a bit. Anyone know whats wrong?

Here are the errors:


1>------ Build started: Project: circle, Configuration: Debug Win32 ------
1>Compiling...
1>circle.cpp
1>c:\users\emcy\documents\visual studio 2008\projects\circle\circle\circle.cpp(39) : error C2664: 'diameter' : cannot convert parameter 1 from 'double (__cdecl *)(double,double,double,double)' to 'double'
1> Context does not allow for disambiguation of overloaded function
1>c:\users\emcy\documents\visual studio 2008\projects\circle\circle\circle.cpp(40) : error C2664: 'circumference' : cannot convert parameter 1 from 'double (__cdecl *)(double,double,double,double)' to 'double'
1> Context does not allow for disambiguation of overloaded function
1>c:\users\emcy\documents\visual studio 2008\projects\circle\circle\circle.cpp(41) : error C2664: 'area' : cannot convert parameter 1 from 'double (__cdecl *)(double,double,double,double)' to 'double'
1> Context does not allow for disambiguation of overloaded function
1>Build log was saved at "file://c:\Users\Emcy\Documents\Visual Studio 2008\Projects\circle\circle\Debug\BuildLog.htm"
1>circle - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

And here is the code:

#include <iostream>
#include <cmath>

using namespace std;

double radius(double x, double y, double xs, double ys);
double diameter(double x);
double circumference(double x);
double area(double x);

const double pi = 3.141;

int main()

{
double centerX;
double centerY;
double pointX;
double pointY;
double radiusMain;
double diameterMain;
double circumferenceMain;
double areaMain;

cout << "This program will calculate the radius, diameter, circumference and area \n of a circle if the user gives the locaction of the center point and \n a point on the circle."<< endl;
system("pause");
system("cls");

cout << "Enter the x coordinate for the center of the circle. \n" << endl;
cin >> centerX;
cout << "Enter the y coordinate for the center of the circle. \n" << endl;
cin >> centerY;
cout << "Now enter the x coordinate for any point on the circle. \n" << endl;
cin >> pointX;
cout << "Now enter the y coordinate for any point on the circle. \n" << endl;
cin >> pointY;

radiusMain = radius(centerX, centerY, pointX, pointY);
diameterMain = diameter(radius);
circumferenceMain = circumference(radius);
areaMain = area(radius);

cout << "The radius of the circle is " << radiusMain << endl;
cout << "The diameter of the circle is " << diameterMain << endl;
cout << "The circumference of the circle is " << circumferenceMain << endl;
cout << "The area of the circle is " << areaMain << endl;

return 0;

}


double radius(double x, double y, double xs, double ys)
{
double radiusfunc;
radiusfunc = sqrt(pow((x-xs),2) + pow((y-ys),2));

return radiusfunc;
}


double diameter(double x)
{ double diameterfunc;
diameterfunc = x * 2;

return diameterfunc;
}

double circumference(double x)
{
double circumferencefunc;
circumferencefunc = 2 * pi * x;

return circumferencefunc;
}

double area(double x)
{
double areafunc;
areafunc = pi * pow(x,2);

return areafunc;
}

You forgot to change radius to radiusMain on those 3 lines.

Also, please use code tags [code] //code here [/code] when posting your code to preserve formatting and make it easier to read.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.