bool operator< (const data& d1, const data& d2) { // return true if d1 is "less than" d2, false otherwise return strcmp(d1.getName(), d2.getName()) < 0; }
bool operator< (const data & aData1, const data & aData2) { char name1[100]; char name2[100]; aData1.getName(name1); aData2.getName(name2); if (strcmp(name1, name2) == -1) return true; else return false; }
data::data(const data & aData) { char tempName[100]; char tempPhone[100]; char tempProduct[100]; char tempEvents[100]; aData.getName(tempName); this->name = new char[strlen(tempName) + 1]; strcpy(name, tempName); aData.getPhone(tempPhone); this->phone = new char[strlen(tempPhone) + 1]; strcpy(phone, tempPhone); aData.getProduct(tempProduct); this->product = new char[strlen(tempProduct) + 1]; strcpy(product, tempProduct); aData.getEvents(tempEvents); this->events = new char [strlen(tempEvents) + 1]; strcpy(events, tempEvents); }
void hashTree::insert(treeNode*& root, data& aData) { char key[100]; char compare[100]; if (root) { root->item->getName(compare); aData.getName(key); } if(!root) { root = new treeNode(&aData); size++; } else if(strcmp(key, compare) < 0) { insert(root->left, aData); } else { insert(root->right, aData); } }
bool operator== (const data& d1, const data& d2) { // return true if d1 is equal to d2, false otherwise return strcmp(d1.getName(), d2.getName()) == 0; }