私は C++ の初心者で、今日 Hello World を書きました。
#include <iostream>
int main(){
double x = 6.25;
x = sqrt(x);
std::cout << x;
return 0;
}
これはVisual Studioで機能し、エラーメッセージは表示されませんでしたが、追加中:
#include <cmath>
同様にうまくいきました。
しかし、オンラインの GCC コンパイラでは、前のコードは次のように返されます。
main.cpp: In function 'int main()':
main.cpp:5:12: error: 'sqrt' was
not declared in this scope x = sqrt(x);
^
助けてください、ありがとう。