#469: 在ACM裡AC為啥這會CE?


luckysky (luckysky)

學校 : 國立中央大學
編號 : 2338
來源 : [140.115.217.26]
最後登入時間 :
2008-12-01 22:51:05

編譯錯誤, 請檢查語法是否符合系統『ANSI/ISO C/C++ by GNU』的要求。
錯誤訊息:
/tmp/code_42342.cpp: In function `int main(int, char**)':
/tmp/code_42342.cpp:15: error: call of overloaded `sqrt(int&)' is ambiguous
/usr/include/bits/mathcalls.h:157: error: candidates are: double sqrt(double)
/usr/include/c++/3.3/cmath:550: error:                 long double
   std::sqrt(long double)
/usr/include/c++/3.3/cmath:546: error:                 float std::sqrt(float)
/tmp/code_42342.cpp:23: error: call of overloaded `sqrt(int&)' is ambiguous
/usr/include/bits/mathcalls.h:157: error: candidates are: double sqrt(double)
/usr/include/c++/3.3/cmath:550: error:                 long double
   std::sqrt(long double)
/usr/include/c++/3.3/cmath:546: error:                 float std::sqrt(float)
#470: Re:在ACM裡AC為啥這會CE?


POOHccc ()

學校 : 國立臺中技術學院
編號 : 1139
來源 : [220.135.97.253]
最後登入時間 :
2012-02-04 21:23:42

編譯錯誤, 請檢查語法是否符合系統『ANSI/ISO C/C++ by GNU』的要求。
錯誤訊息:
/tmp/code_42342.cpp: In function `int main(int, char**)':
/tmp/code_42342.cpp:15: error: call of overloaded `sqrt(int&)' is ambiguous
/usr/include/bits/mathcalls.h:157: error: candidates are: double sqrt(double)
/usr/include/c++/3.3/cmath:550: error:                 long double
   std::sqrt(long double)
/usr/include/c++/3.3/cmath:546: error:                 float std::sqrt(float)
/tmp/code_42342.cpp:23: error: call of overloaded `sqrt(int&)' is ambiguous
/usr/include/bits/mathcalls.h:157: error: candidates are: double sqrt(double)
/usr/include/c++/3.3/cmath:550: error:                 long double
   std::sqrt(long double)
/usr/include/c++/3.3/cmath:546: error:                 float std::sqrt(float)



改用 sqrt((double) var);

紅色部分必加!!