- #1
Trista
- 33
- 0
I'm having some trouble writing the menu part of this program. Right now, I have everything in main() just for ease of compiling. The file is attached.
There are 5 basic commands: I, D, L, A, E
I = insert a line, D = Delete a line, L = list a line, A = Append to end of list,
E = exit.
Thats easy. The hard part is that a line number may follow the command.
I 5 means insert a string that follows before line 5.
D 5-13 means delete lines 5 through 13.
L 3 - 7 means list lines 3 - 7.
If text follows the numbers then it is considered a string and not a command.
I bring in the line using cin.getline(newString, 255, \n). newString is of type char. I'm not sure what to do with the loop to determine if there are numbers, then if the line is more than one digit ( 20 ) how do I push them together to represent the line number, AND then if there is letters after the numbers its a string... its all so confusing!
Please help me get through this!
thank you so much for your help!
Trista
There are 5 basic commands: I, D, L, A, E
I = insert a line, D = Delete a line, L = list a line, A = Append to end of list,
E = exit.
Thats easy. The hard part is that a line number may follow the command.
I 5 means insert a string that follows before line 5.
D 5-13 means delete lines 5 through 13.
L 3 - 7 means list lines 3 - 7.
If text follows the numbers then it is considered a string and not a command.
I bring in the line using cin.getline(newString, 255, \n). newString is of type char. I'm not sure what to do with the loop to determine if there are numbers, then if the line is more than one digit ( 20 ) how do I push them together to represent the line number, AND then if there is letters after the numbers its a string... its all so confusing!
Please help me get through this!
thank you so much for your help!
Trista