Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

struct node { int empID; char *empName; char *empAddress; float empSalary; node

ID: 3614622 • Letter: S

Question

struct node
{ int empID;
char *empName;
char *empAddress;
float empSalary;
node * pNext;

node *nxt;// Pointer tonext node
};

node *start_ptr =NULL;
node *current; // Used to move along the list
int option = 0;

void add_node_at_end()
{ node *temp, *temp2; // Temporary pointers

// Reserve space for newnode and fill it with data
temp = new node;
cout << "Please Enter EmpID ";
cin >> temp->empID;
cout << "Please Enter EmpName: ";
cin >> temp->empName;
cout << "Please Enter EmpAddress: ";
cin >> temp->empAddress;
cout << "Please Enter Emp Salary: ";
cin >> temp->empSalary;
temp->nxt = NULL;

// Set up link to thisnode
if (start_ptr == NULL)
{ start_ptr = temp;
current = start_ptr;
}
else
{ temp2 = start_ptr;
// We know this is not NULL - list not empty!
while (temp2->nxt != NULL)
{ temp2 = temp2->nxt;
// Move to next link in chain
}
temp2->nxt = temp;
}
}

void display_list()
{ node *temp;
temp = start_ptr;
cout << endl;
if (temp == NULL)
cout << "The list is empty!" << endl;
else
{ while (temp != NULL)
{ // Display details for what temp points to
cout << "Enter EmpName : " << temp->empName <<" ";
cout << "Enter EmpID : " << temp->empID << "";
cout << "Enter EmpAddress: " <<temp->empAddress;
cout << "Enter Emp Salary: " << temp->empSalary;
if (temp == current)
cout << " <-- Current node";
cout << endl;
temp = temp->nxt;

}
cout << "End of list!" << endl;
}
}

void delete_Record()
{ node *temp;
temp = start_ptr;
start_ptr = start_ptr->nxt;
delete temp;
}

void main()
{ start_ptr = NULL;
do
{
display_list();
cout << endl;
cout << "Please select an option : " << endl;
cout << "0. Exit the program." << endl;
cout << "1. Insert New employee," << endl;
cout << "2. Delete a record from the list." <<endl;

cout << endl<< " >> ";
cin >> option;

switch (option);
{
case 1 : Insert New employee(); break;
case 2 : delete_Record(); break;
case 3 : Display Report(); break;


}
}
while (option != 0);
}
{/code}

Explanation / Answer

please rate - thanks it now compiles-I can't do any more since I don't know pointers you still have yo write void Insert_New_employee() and void Display_Report() I indicated where #include using namespace std; struct node { int empID; char *empName; char *empAddress; float empSalary; node * pNext; node *nxt;// Pointer to next node }; node *start_ptr = NULL; node *current; // Used to move along the list int option = 0; void add_node_at_end() { node *temp, *temp2; // Temporary pointers // Reserve space for new node and fill it with data temp = new node; cout > temp->empID; cout > temp->empName; cout > temp->empAddress; cout > temp->empSalary; temp->nxt = NULL; // Set up link to this node if (start_ptr == NULL) { start_ptr = temp; current = start_ptr; } else { temp2 = start_ptr; // We know this is not NULL - list not empty! while (temp2->nxt != NULL) { temp2 = temp2->nxt; // Move to next link in chain } temp2->nxt = temp; } } void display_list() { node *temp; temp = start_ptr; cout