Question
C++ LINEAR LINK LIST You will create a main.h and a main.cpp file for this Lab. In the main.h file include the following struct declaration
C++ LINEAR LINK LIST
You will create a main.h and a main.cpp file for this Lab. In the main.h file include the following struct declaration
for the element struct. This is your linked list element.
Your main.cpp program will store all of its command line arguments (the elements in the argv array) in a linked list of element. Your program will need a list head pointer: element * head; that points to the first element of the list. All elements in the list should be dynamic variables created by a new command.
- For each command line argument:
- Store the command line argument in a new element variable
- Append the element to the end of the linked list
- After loading the list, display the contents of the list
- Prompt the user for a word to delete from the list
- Remove the word from the linked list.
- Display (again) the list - the target word should no longer be in the list
Your program must avoid any memory leaks - be sure to delete anything you created before the program ends! Here is an example of how your program should behave:
// Element struct struct element std::string word; *next // Word to save // Next pointer element syccuxas01> main this is a test of lab 5 ord "main" ord "this" ord "is" Nord "a" = ord "test" ord"of" ord "1ab" Word - "5" Enter word to delete: main "main" deleted from the 1ist: ord "this" ord "is" Nord "a" = ord "test" Nord "of" = Nord = "lab" ord"5Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started