Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ , write a program to create a doubly linked list from an input file (input.txt). The number of items is unknown. Then, the

In C++, write a program to create a doubly linked list from an input file (input.txt). The number of items is unknown. Then, the program should display the results and saved into an output file (output.txt).

Use these concepts for the program:

1) DO NOT USE classes 2) Use Struct Node 3) Use Stacks 4) Possibly Push and Pop

Instructions:

1. (Delete from head) Prompt the user for a node number. Starting from the head, moving forward, go to the node and delete it.

2. (Delete from tail) Prompt the user for another node number. Starting from the tail, moving backward, go to the node and delete it.

3. Write the contents of the modified list into the file (output.txt).

NOTE: The node to be deleted can be the head, the tail or something in the middle. If there is only one node in the list and it is being deleted, then both the head and tail are affected by this.

Example:

Input file

59 22 23 58

Which item do you want to delete from the beginning? 3 //the first delete would remove 23 from the list.

Which item do you want to delete end? 2 //The second delete would remove 22 from the list.

Output file and display:

59 58

---------------------------

Thank you!

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

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions