You are to analyse and design a solution for a simple line editor program which responds to the following commands:
E: Enters edit mode. Allows entry of text. Assume each line is a max of 80 characters and terminate by entering the # symbol. N: Displays line N. and sets the line index to N. D: Deletes the current line. A: Append mode. Text is inserted after the current line. To leave append mode the user types a #. P: Print the document on screen. Q: Quit.
Your proposed solution will have two modes of operation. The default setting is command mode i.e. waiting for one of the above commands. Once a command is entered the program will be in operation mode i.e. inside one of the above commands. Once the command is completed it will be back in command mode. It is strongly recommended you develop the solution in a modular fashion i.e. not simply one huge block of code.
大概意思就是编一个简单的行输入程序,按E代表输入数据,每个被输入的数据后要有#作为结束。按N再加行数号可以进入被选行。D意思是删除当前所在的行。A的意思是插入,P为打印,Q是退出。里面还特别指出每次输入最多80个字符。进入程序后按着几个字母就可以表现所要做的command. 小弟为初学者,虽然问题简单,但是还是没有什么思路。望各位老大们帮助~万分感谢 如果觉得麻烦,给个pseudocode介绍一下大体思路也行。3Q!