I\'m working on a C++ program for class, and my compiler is complaining about an \"ambiguous\" function call. I suspect that this is because there are several functions defined
What's happened is that you've included
(indirectly, since it's included by iostream
) along with using namespace std;
. This header declares two functions in std
with the name abs()
. One takes and returns long long
, and the other returns long
. Plus, there's the one in the global namespace (that returns int
) that comes from
.
To fix: well, the abs()
that takes double is in
, and that will actually give you the answer you want!