Tarrant County College District C++ Worksheet
Description
- Load the attached code into a project. Both files will be need to be modified and submitted for this assignment.
- Compile the existing code as-is. The LinkedList.h file should be in the header section of the Solution Explorer.
- Test Step – In the Driver13_3.cpp file
- Display “*** Test Step 3 ****”
- Use the insertNode() method to load 5 unique the integers to the linked list.
- Display the the contents of the linked list.
- The displayed results are expected to be in ascending order but can be inserted in any order.
- Modify the insertNode() method
- Add a boolean parameter to indicate only unique inserts are allowed. This parameter should have a default value of false.
- Change the return type of this method to be a bool. It should return false when (a duplicate already exists and the parameter is true) or return true when an insert occurs.
- Do not do a “pre-search” for this value. Follow the insert code but stop the insert if a match is found.
- In the Driver13_3.cpp file,
- Display “*** Test 5 ****”
- Use the insertNode() method and pass it a unique number and include the 2nd parameter of true.
- Use the insertNode() method and pass it a number already given and include the 2nd parameter of false.
- Display the contents of the linked list. The number from Step 5C should be displayed twice.
- Create a clear() method in the LinkList template.
- This method should remove all the entries in the linked list.
- It should set the head to nullptr.
- Comment this method in way similar to existing methods.
- Modify the destructor to call this method in lieu of it’s own code.
- The class destructor should still display “Linked List Destructor has completed.”
- Modify the deleteNode() method.
- Change this method to return a bool to indicate that a delete was done (true) or not done (false).
- Change the method to correctly return the expected result.
- In the Driver13_3.cpp file
- Display “*** Test 8 ****”
- Call the linked list clear() method
- Use the insertNode() method to load the integers 101, 202,303,404,505 to the linked list
- Use the deleteNode() method to delete number 101. Report if successful.
- Use the deleteNode() method to delete number 998. Report if successful.
- Allow the code to end normally. It should report “exited with code 0” in the console window as usual (No special code for this).
- The provided code should display “Linked List Destructor has completed.” per the LinkedList destructor.
- Complete all TODO items in the Driver13_3.cpp program and remove the TODO indicators once completed.
Deliverables include the modified Driver13_3.cpp, the modified LinkedList.h and a Screen Shot of the generated results. Content may be zipped.
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."