hi everyone this is my solution but there is a problem..
can someone help me on the inserting value into vector of string
this is the header fileCode:/ insert a value into the set // Pre: a string value // Post: the value is inserted into the set if it // is not already present void StringSet::insert(string value) { int contentSize = contents.size(); for(int i = 0; i < 4; i++) { if(contents[i] != value) contents.push_back(value); } }
Code:using namespace std; // StringSet // Class holding a set of strings class StringSet { private: vector <string> contents; public: // insert a value into the set // Pre: a string value // Post: the value is inserted into the set if it // is not already present void insert(string value); // test for a value // Pre: a string value // Post: returns 1 if the value is present in the StringSet, 0 otherwise int contains(string value); };