C++ Math - sqrt (squareRoot, 제곱근)C++ Math - sqrt (squareRoot, 제곱근). stl, math.h, 씨쁠쁠, example code, 예제코드C++ Math - sqrt (square root, 제곱근, 루트). stl, math.h, 씨쁠쁠, example code, 예제코드
math.h 헤더 추가해주고,
sqrt -> 제곱근 (square root)
반환되는 자료형만 차이가 있고 sqrt, sqrtf, sqrtl 다 같은 기능
There are some difference between sqrt, sqrtf, and sqrtl. All is the same square root function, but return type.
msdn below
https://docs.microsoft.com/ko-kr/cpp/c-runtime-library/reference/sqrt-sqrtf-sqrtl?view=vs-2019
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char *argv[]) {
double returnVal;
returnVal = sqrt(1938);
cout << returnVal << endl;
returnVal = sqrt(9);
cout << returnVal << endl;
returnVal = sqrt(99);
cout << returnVal << endl;
}
Result below
44.0227
3
9.94987