Question:
Please help *codings* (for data structure) in c++. (simple codings please! >.<)?
?
2012-02-07 15:31:19 UTC
A C++ Program (for Data structures) using LINKED LIST that could add a node in front, middle, last, and how to delete a node... Please help me! Anyone?! :(

I really need a simple program... Thanks a lot! >.<
Three answers:
Shingetsu Kurai
2012-02-07 15:44:58 UTC
I'll help you know what a linked list is, and help u make a class. I won't do it for you though.

A linked list contains 2 pointers to a custom struct.

That struct is generic and contains an object of your value type and a pointer to the same object type.



each next object points to the next object.

The 1st pointer points to the 1st object.

The 2nd pointer is what the last object points to, it should also return the last objects.



To put in values change pointer assignments! That simple.



To access an object do something like:



T* result = FirstObject;

for(int i=0; i
{

result = result.Next;

}
SomeGuy
2012-02-07 15:36:04 UTC
You can't post on here expecting us to do your homework for you. At least attempt it first and when you run into a problem then post your code and we can show you how to fix your code so that it works.
Carl1989
2012-02-07 15:37:51 UTC
Go to the following link and browse around.



http://homepage.usask.ca/~sds797/TA/tutorials_cmpt115_summer2007/



This whole website is in the "C" not C++ but you will get the idea.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...