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"
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
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