Question: C++ Implement a line editor using linked lists. You must implement your own linked list. A document will be represented by a linked list. Each

C++ Implement a line editor using linked lists. You must implement your own linked list.

A document will be represented by a linked list. Each line in the document is a node in the linked list. Each line in the document is 80 characters. Users can insert, delete or modify lines in the document or print the entire document. Out of bounds print or delete requests are ignored.

User commands:

insertEnd "text" -- insert given text at the end of the document

insert 3 "text" --insert given text at the line indicated by index given

delete 3 --- delete line at index given

edit 3 "text" --- replace the line at the index given with the given text

print -- print the entire document, with line numbers

search "text" -- print the line number and line that contains the given text. print "not found" if it is not found

quit - quit/exit the program

Sample input 1:

insertEnd "now is the time"

insertEnd "for all good men"

insertEnd "to come to the aid of their country"

print

search "come to the aid"

quit

Sample output 1:

1 now is the time

2 for all good men

3 to come to the aid of their country

3 to come to the aid of their country

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!