Question: In this project, you will implement an application of stack: Text editor with differential Undo / Redo . Your application should be able to load
In this project, you will implement an application of stack: Text editor with
differential UndoRedo
Your application should be able to load a string from the text file to the computer
memory, manipulate the loaded text by inserting or removing strings, and perform
the undoredo operations on the text. Then, the application writes the modified
text to the new output file based on the user's request. When the program prints
the content of the stack, it shall keep its content without any change. Clear the
stack's content when writing the modified text for the output.
You shall implement two stacks using linked lists and one queue:
Undo Stack: stores the differential changes insertremove made to the
text, including the word, operation type, and position starting index
Redo Stack: stores changes undone by the user, allowing for redo
operations involves the text involved, the operation type, and the index.
Add Queue: Stores the words for the added string, then these words are
added from the queue to both text and the undo stack.
UndoRedo: Undo pops the word from the undo stack, pushes it to the redo stack,
and reflects these changes to the text Redo pops the entries from the Redo stack,
reapplying changes to the text. The UndoRedo can be done while the stacks are
not empty, while the stacks are cleared when the user saves the text to the output
file. Insertremove operation can be done anywhere in the text; the text is updated
up to each insertremove or UndoRedo operation.
Your application should be able to show the following information through a proper
menu of the application:
Load the input file which contains the initial text.
Print the loaded text.
Insert strings to the text.
Remove strings from the text.
Perform Undo operation
Perform Redo operation
Print the Undo Stack and the Redo stack
Save the updated text to the output file.
Exit
Explanation Examples: The initial test is "Welcome to Data Structures and Algorithms."
Insert: "Course code is COMP First, we add it to the queue, then to the Undo.
front COMP Is code Course rear
Undo Stack: means the addition happens at the end of the original text
Token Operation index
Insert
COMP Insert
Is Insert
Code Insert
Course Insert
The updated text:
Insert: "This is an easy course."
Queue:
Undo Stack:
Course Insert
Easy Insert
An Insert
Is Insert
This Insert
Insert
COMP Insert
Is Insert
Code Insert
Course Insert
front course easy an is This rear
Welcome to Data Structures and
Algorithms. Course code is COMP Original text becomes:
Remove: delete "Algorithms" the program searches for the first occurrence that
matches the string to be deleted, deletes it and adds it with its starting index to the undo
stack mark its status as delete, and its location to the starting index of "algorithm"
Undo Stack: means the addition happens at the end of the original text
Algorithms remove
Course insert
Easy Insert
An Insert
Is Insert
This Insert
Insert
COMP Insert
Is Insert
Code Insert
Course insert
Text becomes:
The word "algorithms" disappeared but was logged to the undo stack.
Now, after executing undo operations, the stacks are as follows:
The Undo Stack The Redo Stack
An Insert
Is Insert
This Insert
Insert
COMP Insert Easy Insert
Is Insert Course insert
Code Insert Algorithms remove
Note: the stack nodes contain the word we insert or remove, the starting index of that word,
and the operation type insertremove
"Welcome to Data Structures and. Course code is COMP This is an easy course"
Welcome to Data Structures and Algorithms. Course
code is COMP This is an easy courseYour application should have all functionalities working properly.
The following notes will be considered during the grading process:
a There has to be adequate documentation and comments in the code ie
functions, loops, etc.;
b Your code should follow the code convention ie spaces, indentations,
etc.; and
c Your application should contain a menu to allow the user to select which
option s he would like to run.
Properly handling file IO errors, invalid user inputs, and edge cases in text
editing operations.please write all the functions and give me full code for the project using c language
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
