Skip to content

Combined use of linked-list and stack data structures in C++

Notifications You must be signed in to change notification settings

bersoy12/StringLinkedList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

String Linked List Project

Task in this project is to write a command-based text editor.

  • This text editor will print the contents of a file to the screen, page by page.
  • Each page consist of 10 lines.

Program keeps the contents of the file in certain data structures, and supports certain commands described below.

Data Structures

Features

  • Lines -string objects- are kept in a linked list structure.
  • Each line is stored in a separate node.
  • A stack utilized in order to keep track of all actions carried out so that undo actions can be done.

Commands

While program is running, it repeatedly prints the contents of the current file, and asks the user what user would like do. Valid commands are:

  1. open filename: Opens the file whose name is provided in the field filename and loads each line into linked list.
open filename.txt
  1. save filename: Writes the contents of the linked list to the file whose name is provided in the filename field.
save filename.txt
  1. insert n text: Inserts a new line in the text at the nth line, which contains the string provided in the field text ( hello my friend ).
insert 5 hello my friend
  1. delete n: Deletes the line at position n.
delete 4
  1. move n m: Moves the line at position n to position m.
move 5 8
  1. replace n text: Program replaces the text inside line n with the string provided in text.
replace 3 text
  1. next: Contents of the file does not change, but displays the next page.
next
  1. prev: Contents of the file does not change, but displays the previous page.
prev
  1. undo: Reverts the last taken action. User is able to call as many undo commands. Careful! Undo command does not include previous save or undo actions.
undo

About

Combined use of linked-list and stack data structures in C++

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages