Question: Linked Lists //Complete the line editor program below by implementing all member functions as instructed. #include #include fstream > Hinclude #include using namespace std; struct



\#include \#include fstream > Hinclude \#include using namespace std; struct node \{ string line; node* next, " prev; node() \{ node(string s): line(s) \{\} \} class editor \{ private: node* head, * tail; node* current; public: editor() \{ head = new node; tail = new node; head > next = tail; tail->prev = head; current = head; \} void insert(node newLine, node* before): I/ insert a new line after void insert(string s); I/ create a line of s and insert it after using the preceding function void multiplelnsert(); //Insert multiple lines with a " " as a terminal line void forward); I/ move > one line forward unless the next is void backward(); // move > one line backward unless the current is head void removeCurrent(); // delete the current line (node) and let current point to the preceding line void displayCurrent(ostream\& os); // print the current line void displayAll(ostream\& os); // print all lines void save(ostream\& os); // print all lines bool readLine(istream\& is); // read a new line and insert it after using insert(string) void clear(); I/ delete all lines void load(ifstream\& f ); // erase the entire workplace and load a file to the workplace void gotoline(); // Ask the user to enter line number (i) then make the line(i) void find(node start = nullptr); I/ Ask the user to enter a string. Search the entire workspace for this string; // if found, display the found instance, and prompt the user for a subsequent instance. void replace(node start = nullptr); // Similar to the function find but with the option of replace a string by another string \} void menu() \{ system("cls"); cout "press: In"; cout " i to insert a new lineln"; cout m to insert multiple linesin"; cout " d to delete the current new lineln"; cout " c to display the current lineln"; cout " g to go lineln"; cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
