I need help with my C assignment Design your own linked list
I need help with my C++ assignment.
Design your own linked list class to hold a series of integers. The class should have member functions for appending, inserting, and deleting nodes. Don\'t forget to add a destructor that destroys the list. Demonstrate the class with a driver program. Modify the linked list class you created in Programming Challenge 1 to add a print member function. The function should display all the values in the linked list. Test the class by starting with an empty list, adding some elements, and then printing the resulting list out.Solution
#include<iostream>
 using namespace std;
class Node
 {
 public:
 int data;
 Node *next;
 Node(int data)
 {
 this->data = data;
 this->next = NULL;
 }
 };
class LinkedList
 {
 private:
 Node *head;
public:
 LinkedList()
 {
 head = NULL;
 }
  
 void addToFront(int data)
 {
 Node *temp = new Node(data);
   
 if(head == NULL)
 head = temp;
 else
 {
 temp->next = head;
 head = temp;
 }
 }
   
 void append(int data)
 {
 Node *temp = new Node(data);
 Node *current = head;
   
 if(current == NULL)
 {
 head = temp;
 return;
 }
   
 while(current->next != NULL)
 {
 current = current->next;
 }
   
 current->next = temp;
 }
   
 void print()
 {
 Node *current = head;
   
 if(current == NULL)
 cout << \"No element in list. \ \";
   
 while(current != NULL)
 {
 cout << current->data << \" \";
 current = current->next;
 }
 cout << endl;
 }
   
 void deleteLinkedList()
 {
 Node *prev;
 Node *current = head;
   
 while(current!=NULL)
 {
 prev = current;
 current = current->next;
 delete prev;
 }
 }
   
 void deleteLastNode()
 {
 Node *current = head;
 Node *prev = NULL;
   
 if(current == NULL)
 return;
   
 while(current->next != NULL)
 {
 prev = current;
 current = current->next;
 }
   
 if(prev == NULL)
 {
 delete current;
 head = NULL;
 }
 else
 {
 prev->next = NULL;
 delete current;
 }
 }
   
 ~LinkedList()
 {
 deleteLinkedList();
 }
 };
int main()
 {
 LinkedList list;
 list.append(2);
 list.append(3);
 list.append(4);
 list.addToFront(1);
   
 cout << \"Content of LinkedList is : \";
 list.print();
   
 list.deleteLastNode();
 cout << \"Content of LinkedList is : \";
 list.print();
 return 0;
 }
OUTPUT:
Content of LinkedList is : 1 2 3 4
 Content of LinkedList is : 1 2 3



