I'm tasked with writing a c++ program that creates a sort of text editor in the terminal. The text editor consists of individual lines. Each individual line must represent a member of a linked list. I'm following a format of making two classes. One being a "list" of lines and the other being a class for the lines. They are friend classes. For every new line a line object is created and added to the linked list. The "list" of lines class manages the line objects and the linked list by performing operations such as inserting lines and deleting them from the linked list.
My question is, for each individual line should I store it as a character array, a string, or a vector?
It should also be noted that the lines need not be editable once they are added to the linked list. They can just be deleted and a new line can be inserted. Only three operations will be possible. Inserting an entire line into the list, adding a line to the end of the list, and deleting an existing line from the list. The content of any given line will not be altered after it is created and added to the list.
Some sample output that I was given:
1> The first line
2> The second line
3>
4> And another line
5> One more line
6>
7> what do you try to type here?
8>
9>
10>
11> This is the last line
> I 2 ↵
2> This line should be inserted into line number 2
> L ↵
1> The first line
2> This line should be inserted into line number 2
3> The second line
4>
5> And another line
6> One more line
7>
8> what do you try to type here?
9>
10>
11> This line is boring......
12> This is the last line
> I 16 ↵
16> The line number is big BIG
> L ↵
1> The first line
2> This line should be inserted into line number 2
3> The second line
4>
5> And another line
6> One more line
7>
8> what do you try to type here?
9>
10>
11> This line is boring......
12> This is the last line
13>
14>
15>
16> The line number is big BIG
std::list<std::string>, then if your assignment requires it write your own alternative list class that has a similar interface (exactly the same may be a bit hard, as it may require implementingiterators which isn't a beginner-friendly ask).