Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that includes the following Define the LinkedList class template in the header file LinkedList.h // LinkedList.h #ifndef LLH #define LLH -

image text in transcribed

image text in transcribed

Write a C++ program that includes the following Define the LinkedList class template in the header file LinkedList.h // LinkedList.h #ifndef LLH #define LLH - using namespace std; template class LinkedList public: // Constructor LinkedList(); //Desctructor LinkedList); /I Makes the list to the empty state void make_empty(); // Returns the size of list int get_size() const; /I Check if item is in the list. bool find(T item) const; / Insert item 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 remove(T item); // Prints the list void print () const; private: struct NodeType T data; NodeType* next; 3: int size; I/ the size of the linked list NodeType* head; #end if Please read the comments carefully and implement the LinkedList class template in the file LinkedList.cpp // LinkedList.cpp #include #include "LinkedList"h" template LinkedList: LinkedList) size 0; head NULL; // add other member functions The main function is contained in the file laba3.cpp // labe3.CPP #include #include "LinkedList . h" #include "LinkedList.cpp.. int main () The main function, 1. 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 0 3. Prompty the user to enter k (the number of values to be removed), and remove k values from the front. 4. 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 adding the values when the user enter "exit". 7. Prompty the user to enter k (the number of values to be removed), and remove k values from the front. 8. Print the values of stored in the linked list The expected result Create a list of integers: 10 20 30 40 50 60 70 80 90 e How many values you want to remove? 3 The list is: 60 50 40 30 20 10 Create a list of strings: Jim Tom Alice Bob Ellen Bella Smith Don exit How many values you want to remove? 3 The list is: Ellen Bob Alice Tom Jim

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

What kinds of reports might be sent to customers?

Answered: 1 week ago

Question

=+f. Audience Engagement encourage consumer participation.

Answered: 1 week ago