string aux;
int maxy, auxx = 0;
cin >> aux;
maxy = (int)sqrt(aux.size());
Why am I getting this error:
1> error C2668: 'sqrt' : ambiguous call to overloaded function
1> could be 'long double sqrt(long double)'
1> or 'float sqrt(float)'
1> or 'double sqrt(double)'
string::size()returnssize_t, andsqrtdoesn’t accept it in any of its versions. So the compiler has to cast, and cannot choose to what – all of them are OK. You have to put explicit cast: