Ambiguous call to overloaded function 'pow'

前端 未结 4 1192
逝去的感伤
逝去的感伤 2020-12-20 18:55

I\'m having some problems runnning the following code. I got this: error C2668: \'pow\' : ambiguous call to overloaded function. I\'ve tried to manually cast the arguments t

4条回答
  •  伪装坚强ぢ
    2020-12-20 19:51

    strlen return type is size_t in C++. So you can resolve the ambiguity via casting:

    pow(static_cast(16), strlen(n) - i - 1);
    

    also here:

    result += (n[i] - "A" + 10)
    
                      ^ this should be 'A'
    

    and main should return int instead of void:

    int main(void) { 
    

提交回复
热议问题