I am new to C++ and am working on an assignment for my class...
The error i am getting is the following:
The program:Code:c:\documents and settings\matt\my documents\visual studio 2005\projects\assignment 1a\assignment 1a\assignment 1b.cpp(8) : error C2668: 'atan' : ambiguous call to overloaded function 1> c:\program files\microsoft visual studio 8\vc\include\math.h(545): could be 'long double atan(long double)' 1> c:\program files\microsoft visual studio 8\vc\include\math.h(497): or 'float atan(float)' 1> c:\program files\microsoft visual studio 8\vc\include\math.h(109): or 'double atan(double)' 1> while trying to match the argument list '(int)'
its probably something very intuitive for someone who has some experience but please help me outCode:#include <iostream> #include <string> #include <cmath> using namespace std; int main (void) { const double PI = 4*atan(1); //the constant Pi double d; //diameter double r; //radius double area; //area string name; //your name cout << "What is your name?" << endl; cin >> name; cout << "Enter the diameter of a circle:" << endl; cin >> d; r = 1/2 *d; area = PI * r * r; cout << "Hi " << name << ", the area of a circle with a diameter of " << d << "is" << area << endl; return 0; }
thanks in advance!



LinkBack URL
About LinkBacks



