![[C++] 평균, 표준편차 구하기](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbSc7KO%2FbtsBvqA2q8M%2FTpItrWkJIJokhhDICFMEok%2Fimg.png)
평균 및 표준편차 계산 함수 #include // 평균 계산 함수 template double Mean(std::vector array) { double sum = 0.0; for (int i = 0; i < array.size(); i++) sum += array[i]; return sum / array.size(); } // 표준 편차 계산 함수 template double StandardDeviation(std::vector array) { double meanValue = Mean(array); // 배열 요소가 1개밖에 없을 때는 // NaN(숫자가 아님)이라는 의미로 // sqrt(-1.0) 을 반환 int size = array.size(); if (size < 2) { return sqrt..
![[C++] Is the Point Inside the Polygon?](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcaiaXM%2FbtsBo9ac88q%2F79L6H8KBwAk9nGZwDS6aXK%2Fimg.png)
point-in-polygon (PIP) “In computational geometry, the point-in-polygon (PIP) problem asks whether a given point in the plane lies inside, outside, or on the boundary of a polygon.” Wikipedia. 점이 다각형(Polygon) 내부에 있는지 확인하는 코드입니다. struct Point { int x; int y; }; bool InsidePolygon(int nvert, Point polygon[], int pointx, int pointy) { int i, j = 0; bool inside = false; for (i = 0, j = nvert - 1; i ..
![[C++] DLL 동적 로딩](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FtDb1B%2FbtsBvT38LMD%2FGjnHVnJoXEzkrPnOVHm15K%2Fimg.png)
DLL 동적 로딩 특정 폴더 내에 다수의 DLL 라이브러리 파일들을 로딩하기 위한 코드입니다. Header 파일 // dllload.h #include class DLLLoad { public: DLLLoad() {} ~DLLLoad() {} bool LoadLibrary(); bool FreeLibrary(); private: // DLL 폴더 경로를 설정합니다. const std::string DLL_DIR; // 로딩된 DLL 파일 경로들을 저장하고 관리합니다. std::list fileList; } C++ 파일 // dllload.cpp #include "dllload.h" #include #include const std::string DLLLoad::DLL_DIR = "C:\\dll\\"; D..
![[C++] string을 이용한 File Path 분리 방법](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbU5oVN%2FbtsBqe3xbMK%2FGGJNeUKt0F8W6gKAop0zO1%2Fimg.png)
개요 string 형식의 파일 경로를 이용하여 File Path와 Name을 분리합니다. File Path와 File Name 분리 #include namespace using std; int main() { string pullPath = "c:\\test\\test.tif"; int find = pullPath.rfind("\\") + 1; string filePath = pullPath.substr(0, find); string fileName = pullPath.substr(find, pullPath.length() - find); cout