Lab
Stacks - Text Editor

In this lab you will use apstack objects.

Most text editors have the capacity for the user to make corrections when entering a line of text. The backspace key usually erases the last character typed. Often there is a sequence of keys with the <Ctrl> key that will erase an entire line.

Your task is to write a program that simulates this capacity to edit a line of input. To simplify the task, use '-' to erase the last character typed and '$' to erase the entire line so far entered. This program may only use simple types such as char, int, boolean, and stack structures. In other words, no arrays, strings, strings, etc. are allowed!

Sample Run

   Enter a line of  text:  Ca-noe$Ra3-fx-t
   Here is the line you entered:  Raft

   Again (y/n)?  y

   Enter a line of text:  AP$$-Compp-utee-r Sic--cei--ience
   Here is the line you entered:  Computer Science

   Again (y/n)?  n


Continue to:  Unit 5 / Prev / Next