visual studio 2010 - #include -
What's wrong with the code snippet below that VS2010 will not compile it?
int m = sqrt (n); (I am trying to ensure that there is a prime prime ...)
You have to pass a specific floating point type on sqrt - there is no integer overload. Use eg: long double mi = sqrt (static_cast & lt; long double & gt; (n)); As you include cmath not math.h , I'm assuming that you want C ++ For C, you will need to use eg: double M = sqrt ((double) n); You just error means that the compiler can not automatically select a sqrt function for you - you converted the integer passed to a floating point type And the compiler does not know which floating point type and the sqrt function should be selected.
Comments
Post a Comment