cout<<"The square root of 25 is \t"<<sqrt(25)<<endl;
return 0;
}
_________________
this is an error :
error C2668: 'sqrt' : ambiguous call to overloaded function
____________________
and if i changed this line
cout<<"The square root of 25 is \t"<<sqrt(25)<<endl;
to this
cout<<"The square root of 25 is \t"<<sqrt(25.0)<<endl;
_________________________
an error will disappear.
____________-
i know this
<cmath>
returns a double value
but why when i let sqrt() receive int occurs an error?????????????
i mean this :
sqrt(25.0) = ture
sqrt(25) = false
______________________-
please help ...............
sqrt has many overloads - http://www.cplusplus.com/reference/clibrary/cmath/sqrt/ - so when you pass an int ( which can be implicitly casted to double, float and long double ) the compiler doesn't know which overload to call.