Problem

Write a simple line editor. Keep the entire text on a linked list, one line in a separate...

Write a simple line editor. Keep the entire text on a linked list, one line in a separate node. Start the program with entering EDIT file, after which a prompt appears along with the line number. If the letter I is entered with a number n following it, then insert the text to be followed before line n. If I is not followed by a number, then insert the text before the current line. If D is entered with two numbers n and m, one n, or no number following it, then delete lines n through m, line n, or the current line. Do the same with the command L, which stands for listing lines. If A is entered, then append the text to the existing lines. Entry E signifies exit and saving the text in a file. Here is an example:

EDIT testfile1> The first line2>3> And another line4> I 33> The second line4> One more line5> L1> The first line2>3> The second line4> One more line5> And another line  // This is now line 5, not 3;5> D 2               // line 5, since L was issued from line 5;4> L                 // line 4, since one line was deleted;1> The first line2> The second line   // this and the following lines3> One more line     // now have new numbers;4> And another line4> E

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 3
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT