본문 바로가기

C++ in Windows/STL

set 실습 2 간략한 도서관리 프로그램. set 실습 여기에서 클래스 추가하고, 내부 조금 수정한 프로그램이다. #include #include #include #include #include #include using namespace std; class BookCase { public: string isbn; string name; string amount; BookCase(const string & pIsbn, const string & pName, const string & pAmount ) : isbn(pIsbn), name(pName), amount(pAmount){ } void DataView(){ cout 더보기
set 실습 실습이다. 더이상의 설명은 생략한다.#include #include #include #include #include using namespace std; void main(void) { bool flag = true; set data; while(flag) { string tstr; cout > buf ) tokens.push_back(buf); // 나눈 토큰의 양이 0보다 작으면 다시 입력을 받는다. if ( tokens.size() = 0 ) { char* cmd = new char[tokens[0].length()]; strcpy(cmd , tokens[0].c_str()); if ( strcmp( cmd, "add") == 0 )// add일 경우. { string b; for( unsigned.. 더보기
vector 실습 요 몇년동안 윈도우 CE기반 MFC를 사용했다. 하지만 앞으로는 Window가 아닌 플렛폼에서도 개발을 해야 될꺼 같다. 물론 아직은 C++이 아닌 언어는 본격적으로 할 생각이 없기 때문에. 그런고로 이제는 MFC에서 쉽게 사용하던 CArray, CList와 같은 클래스를 사용할수 없다 생각하고. STL을 사용하여 코딩을 하려한다. 그런고로 자문자답. >> 문제 양수 n를 입력받으면 vector에 n을 기록한다. 음수 n를 입력받으면 현재 데이터의 abs(n)의 값을 삭제한다. 0을 입력받으면 프로그램을 종료한다. #include #include #include using namespace std; void main(void) { vector data; while( true ) { int temp; ci.. 더보기