반응형 stl 문장 내 단어 검색1 STL 문장 내 단어 검색 STL 문장 내 단어 검색문장을 입력하고 단어를 검색할 수 있는 멤버 함수를 가진 contents_t 클래스를 정의한다. STL을 이용하여 find 멤버함수로 문장 내 단어를 검색 할 수 있다. 소스코드 #include "stdafx.h" #include #include class contents_t { private: std::string contents; public: contents_t(std::string c) : contents(c) { } bool find(const std::string &x) const { if( contents.find( x ) == std::string::npos ) return false; // 같다면 ? return true; } }; int main(int argc.. 2010. 8. 9. 이전 1 다음 반응형