Question: Fix the source code on the left to 1. Add a default constructor and a constructor that takes the data for a Node. 2. Create
Fix the source code on the left to
1. Add a default constructor and a constructor that takes the data for a Node.
2. Create a List class that has two fields for head and tail. Add a default constructor.
3. Implement a ListAppend function
4. Implement a ListPrint function
5. write test code in main that creates a new list and then appends three nodes with data 2, 4 and 6 and then prints the list.
#include
// A linked list node
class Node
{
int data;
Node *next;
/* Your solution goes here */
};
/* Your solution goes here */
int main()
{
/* Your solution goes here */
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
