please help C Program Dt Structur3ss class please comment co

please help!! C++ Program D@t@ Structur3ss class

please comment code!

Create all!! Code Using Doubly Linked List

In this project, you should write a simple line editor. Keep the entire text on a linked list, one line in a separate node. Stan the program with entering EDIT file, after which a prompt appeals along with the line number. If the letter I is entered with a number n following it. then insert the text to be followed before line n. If I is not followed by a number, then insert the text before the current line. If D is entered with two numbers n1 and m. one n. or no member following it. then delete lines 11 through 111. line 11. or the current line. Do the same with the command L. which stands for listing lines. If A is entered, then append the text to the existing lines. Entry E signifies exit and saving the text in a file. Here is an Example:

Solution

#include <iostream.h>
#include <fstream.h>
#include <assert.h>
typedef struct Node
{
char character[80];
Node *next, *pre;
}Line;
Line *currentline;
Line *firstline;
Node *head, *tail;
int col;
void createfirstline()
{
Node *p;
p = new Node;
currentline = p;
head = currentline;
tail = currentline;
col = -1;
}
void newline()
{
Node *p;
p = new Node;
p -> next = NULL;
p->pre = currentline;
currentline->next = p;
tail = p;
currentline=p;
col = 0;
}
void createnewline()
{
Node *p;
p = new Node;
p -> next = NULL;
if (head == NULL)
{
head = p;
tail = p;
}
else
{
Node *q = tail;
q->next = p;
p->pre = q;
}
tail = p;
currentline = p;
}

void main()
{
cout << \"Enter string: \";
char string[30];
cin.getline (string,30);
ifstream instream;
instream.open(string);

char reading;
currentline = firstline;
createfirstline();
while(instream.read(&reading,sizeof(reading)))
{
if (reading == \'\ \')
newline();
else
{
col++;
currentline->character[col] = reading;

}
}
instream.close();
}

please help!! C++ Program D@t@ Structur3ss class please comment code! Create all!! Code Using Doubly Linked List In this project, you should write a simple line
please help!! C++ Program D@t@ Structur3ss class please comment code! Create all!! Code Using Doubly Linked List In this project, you should write a simple line

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site