D
dave
I created a circular linked list
whats the best way to search function for a name in the list and retrun that
node address
class PhoneBook
{
friend PhoneBookUserInterface;
public:
PhoneBook();
~PhoneBook(){};
void add(PhoneBookRec &pbr);
void remove(PhoneBookRec &pbr);
PhoneBookRec search(PhoneBookRec &key);
// PhoneBookRec get_rec(int i){return data;}
int get_number_of_entries();
void save(string filename);
void load(string filename);
private: //functions
void insertAfter(ListNode * pInsertAfterThisNode, PhoneBookRec & pbr);
ListNode * findInsertionPtr(PhoneBookRec &pbr);
ListNode * findDeletePtr(PhoneBookRec &pbr);
void deleteAt(ListNode * pDeleteThisNode);
private: //variables
ListNode * pTop;
ListNode *pBottom;
};
#endif
whats the best way to search function for a name in the list and retrun that
node address
class PhoneBook
{
friend PhoneBookUserInterface;
public:
PhoneBook();
~PhoneBook(){};
void add(PhoneBookRec &pbr);
void remove(PhoneBookRec &pbr);
PhoneBookRec search(PhoneBookRec &key);
// PhoneBookRec get_rec(int i){return data;}
int get_number_of_entries();
void save(string filename);
void load(string filename);
private: //functions
void insertAfter(ListNode * pInsertAfterThisNode, PhoneBookRec & pbr);
ListNode * findInsertionPtr(PhoneBookRec &pbr);
ListNode * findDeletePtr(PhoneBookRec &pbr);
void deleteAt(ListNode * pDeleteThisNode);
private: //variables
ListNode * pTop;
ListNode *pBottom;
};
#endif