1. Engineering
  2. Computer Science
  3. write a cprogram that includes the following define the linkedlist...

Question: write a cprogram that includes the following define the linkedlist...

Question details

Write a C++program that includes the following: Define the LinkedList class template in the header file LinkedList.h LinkedList.h #ifndef LL H define LLH #include 108 trean> using nanespace std tenplate <typenane T class LinkedList public: Constructor LinkedListO /Desctructor / Makes the list to the empty state void make emptyoi Returns the size of list int get size) const; Check if iten is in the list bool find (T item) const; Insert iten at the front void insert front (T item): Removes the element fron the front void remove front): Removes the first element which matches item. (optional) void renove(T item) Prints the list void print) const; private: struct NodeType T data NodeType next; int size: I/ the size of the linked list NodeType* head; endif . Please read the comments carefully and implement the LinkedList class template. You can implement the LinkedList class template in the seperate file LinkedList.cpp LinkedList.cpp #include ·LinkedList .h tenplate <typenane T LinkedLit:LinkedList size 0 head NULL add other member funetions You also can put the implementation of the LinkedList class template in LinkedList.h LinkedList.h
You also can put the LinkedList.h #ifndef LL-H define LL H #inelude dostrean> using namespace std template <typenane T class LinkedList public: /I Constructor LinkedList() size 0 head NULL private: struct NodeType T data NodeType* next int size; II the size of the linked list. NodeType head endif . The main function is contained in the file lab03.epp lab03.cpp #include <string> #include LinkedList h #include·LinkedList.cpp. // add if the interface and inplementation)are 8eperate int main) The main function, . Declare a linked list which stores integers. 2. Prompty the user to enter int values and add these values in the int linked list, stop adding the values when the user enter O 3. Prompty the user to enter k (the number of values to be removed), and remove k values from the front Print the values of stored in the linked list. 5. Declare a linked list which stores strings 6. Prompty the user to enter string values and add these values in the string linked list, stop 7. Prompty the user to enter k (the number of values to be removed), and remove k values 8. Print the values of stored in the linked list adding the values when the user enter exit from the front The expected result: Create a list of integers: 10 20 30 40 50 60 70 80 90 0 Bow many values The liat is: 60 50 40 30 20 10 you want to remove? 3 Create a list of strings: Jin Tom Alice Bob Ellen Bella Smith Don exit How many values you want to renove? 3 The 1ist is: Ellen Bob Alice Tom Jim
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution