Question: impliment these functions into the following program // Returns a pointer to the node with matching last name. // Pre: Valid NodePtr and string. //

impliment these functions into the following program

// Returns a pointer to the node with matching last name. // Pre: Valid NodePtr and string. // Post: Returns pointer to matching node or nullptr if not found. NodePtr SearchNode(NodePtr head, string lastName);

// Deletes the node containing the passed string. // Pre: NodePtr points to valid linked list and string points to a valid string // Post: Node containing the passed string has been removed from the list. void DeleteNode(NodePtr, string);

program

// Program to store information read from business cards into a sorted linked list // and save out to a file. #include  #include "buscard.h" using namespace std; // Adds data to an existing node // Pre: Valid NodePtr w/ allocated memory // Post: NodePtr contains valid info or set to nullptr if no info void GetNodeInfo(NodePtr &np); // Fills in the info for a customer // Pre: Valid CustomerType variable // Post: CustomerType filled with info entered by user void FillCustomerInfo(CustomerType &cust); // Allocates memory and initializes nodePtr->next to NULL // Pre: None // Post: Allocated nodePtr with ->next set to NULL NodePtr CreateNode(); // Inserts node into list in sorted location // Pre: Valid pointer for list and prefilled NodePtr // Post: Sorted list void AddNode(NodePtr &head, NodePtr np); // Prints out list // Pre: Valid nodeptr void PrintList(NodePtr np); // Save data to file // Pre: Valid nodeptr void SaveFile(NodePtr np); // Takes a string, making the first letter uppercase and remainder lowercase // Pre: Valid string passed as argument // Post: Returns a normalized string string NormalizeString(string str); int main() { NodePtr headPtr = nullptr; // Pointer to entire list NodePtr newPtr = nullptr; // Pointer for new nodes being added // Loop until user is finished entering Business Cards newPtr = CreateNode(); GetNodeInfo(newPtr); AddNode(headPtr, newPtr); // Save File SaveFile(headPtr); return 0; } NodePtr CreateNode() { cout << "In GetNode" << endl; NodePtr newNode = new NodeType; return newNode; } void GetNodeInfo(NodePtr& np) { cout << "In GetNodeInfo" << endl; FillCustomerInfo(np->customer); } void FillCustomerInfo(CustomerType &cust){ cout << "In FillCustomerInfo" << endl; // Prompt user for info // Normalize first and last name entered cust.lastName = NormalizeString(cust.lastName); cust.firstName = NormalizeString(cust.firstName); } void AddNode(NodePtr& head, NodePtr np) { cout << "In InsertNode" << endl; } void PrintList(NodePtr np) { cout << "In PrintList" << endl; } void SaveFile(NodePtr np) { cout << "In SaveFile" << endl; } string NormalizeString(string str){ cout << "In NormalizeString" << endl; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!