/************ stack.h ************/ #include #include #include using namespace std; class stack { public: bool find(const string &elem) const; int count(const string &elem) const; ... ... private: vector _stack; }; /********** stack.cpp **********/ #include "stack.h" ... ... bool stack::find (const string &elem) const { vector::const_iterator it = _stack.begin(); return (::find(it,_stack.end(),elem))!=_stack.end(); } int stack::count(const string &elem) const { return (::count(_stack.begin(),_stack.end(),elem)); } /*********** main.cpp *************/ #include "stack.cpp" #include int main() { stack st; string str; ifstream readfile("sentence.txt"); while(readfile>>str && !st.full()) { st.push(str); } ... cout<<"\nEnter a word to search: "; cin>>str; if(st.find(str)) cout<<"The word was found "<