Implement a doubly linked list in C++. The data in both txt files must be read f
ID: 3601708 • Letter: I
Question
Implement a doubly linked list in C++.
The data in both txt files must be read from the files.
Letters.txt contains 26 English Letters (You can write the file specification into your program instead of receiving the file name from command line.):.
A
B
C
D
…
Z
Sequence.txt contains a list of numbers (You can write the file specification into your program instead of receiving the file name from command line.)
3,-3,19,-19,18,1,-2,3,-18,17,1,-3,-13,14
You need to
1. Create a doubly linked list by reading the 26 letters from Letters.txt.
2. Sequence.txt file contains a sequence of relative letter positions. Suppose the listData points to the first element in the doubly linked list. The first letter I want to output is the third forward element from the beginning. Then the second letter is the third element backward from the current position. You need to output all letters indicated in sequence.txt
Your job
1. Create a doubly linked list
2. Implement putItem() method
3. Correctly read the files and interpret the information
4. Print out the letters (according to the Sequence.txt file)
Explanation / Answer
#include #include #include /* * Node Declaration */ using namespace std; struct node { int info; struct node *next; struct node *prev; }*start; /* Class Declaration */ class double_llist { public: void create_list(int value); void add_begin(int value); void add_after(int value, int position); void delete_element(int value); void search_element(int value); void display_dlist(); void count(); void reverse(); double_llist() { start = NULL; } }; /* * Main: Conatins Menu */ int main() { int choice, element, position; double_llist dl; while (1) { coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.