I really need some who can show me how to do this. I'm getting deperate. I just can't get it to work
That's the input in the text file and it includes the output (print). The output won't be in there, obviously.
It's just like a "sentence editor" if you will.
delete("is",2)
print 1:This 2:is 3:an 4:an 5:icorrect 6:sntence
delete("an",3)
print 1:This 2:is 3:an 4:icorrect 5:sntence
delete("icorrect",4)
print 1:This 2:is 3:an 4:sntence
insert("incorrect",4)
print 1:This 2:is 3:an 4:incorrect 5:sntence
delete("sntence",5)
insert("sentence",5)
print 1:This 2:is 3:an 4:incorrect 5:sentence
neighbors("is") 2:is previous:This next:an
So, to take the first line, it will put the delete("is",2) into the node and follow the command.
So far I have..
Code:
class List {
private:
Node data;
List *next;
insert() {
if (head == NULL) {
// This is the first node.
} else {
// Subsequent nodes
}
}
delete() {
// Delete via the number here?
//and loop here for the node
prev->next = cur->next; //
// Now, free() or delete the current node?
}
};
I'm guessing that's how you do it. I don't know how to finish this. How to implement the delete, insert, and the loops. Not sure what to do with the print either.. needs to be put into another text file, but I'll see about that.
Can somebody please show me how to do this? Thank you so much!! I hope somebody can help me here.