Question: Write a program to code text editor. Note: Use C++ Language. The goal of this program is to implementing and using stacks and linked structures.

Write a program to code text editor.

Note: Use C++ Language.

The goal of this program is to implementing and using stacks and linked structures. You should also continue to use object-oriented design. For this program, you will implement a text editor. Your editor will display a string of characters and a cursor. Your program will allow the user to move the cursor and modify the text using the following five operations:

  • left - move the cursor to the left one character or do nothing if at the end of the line
  • right - move the cursor to the right one character or do nothing if at the end of the line
  • rdelete n - delete n characters to the right of the cursor
  • ldelete n - delete n characters to the left of the cursor
  • insert c - insert the character c just before the cursor

A sample run of your program should look as follows: ^ insert S S^ insert A SA^ insert M SAM^ insert M SAMM^ insert Y SAMMY^ left SAMM^Y left SAM^MY rdelete 2 SAM^ insert I SAMI^ right SAMI^ left SAM^I ldelete 3 ^I Your program should implement a LinkedStack class which provides a stack interface and stores a series of characters in a linked structure. You should declare two instances of this class. The first will store all of the text to the left of the cursor and the second will store all of the text to the right of the cursor. In addition to the typical stack ADT operations you must implement : (1) a print function for the stack which will print its contents and (2) a pop(i) function which will remove the top i (an integer) elements from the stack. Think carefully about what this special pop function should return.

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!