Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 135,935 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,673 people online right now. Registration is fast and FREE... Join Now!




Linked List Question!

2 Pages V  1 2 >  
Reply to this topicStart new topic

Linked List Question!

marckiestar
1 Oct, 2007 - 06:34 PM
Post #1

New D.I.C Head
*

Joined: 21 Aug, 2007
Posts: 21



Thanked: 1 times
My Contributions
Hi! its my first time to use linked list...... all I know is to store one value in each node. But is it possible to store multiple values in each node of a linked list.

For example : Node a has the following data: (1) Name (2) address (3) Tel. #.
could you show some code on how to implement this?

It's urgent... I need this info asap.
User is offlineProfile CardPM
+Quote Post

nirvanarupali
RE: Linked List Question!
1 Oct, 2007 - 06:42 PM
Post #2

D.I.C Foot
Group Icon

Joined: 1 Aug, 2007
Posts: 983



Thanked: 2 times
Dream Kudos: 375
My Contributions
Hello marckiestar, read the rules first. You must exert some effort to write your codes, then post here together with your problems which you encountered. There are many people who are willing to help you. smile.gif
User is offlineProfile CardPM
+Quote Post

born2c0de
RE: Linked List Question!
1 Oct, 2007 - 06:50 PM
Post #3

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 3,906



Thanked: 34 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
QUOTE
But is it possible to store multiple values in each node of a linked list.

Yes, it is.
Simply create your node structure like this:
CODE
struct node
{
   int data1;
   char data2;
   /* ... */
   float dataN;
   struct node *next;
};


You can also read this Data Structures Tutorial to learn how a Linked List works.
User is offlineProfile CardPM
+Quote Post

nirvanarupali
RE: Linked List Question!
1 Oct, 2007 - 06:59 PM
Post #4

D.I.C Foot
Group Icon

Joined: 1 Aug, 2007
Posts: 983



Thanked: 2 times
Dream Kudos: 375
My Contributions
Linked List Implementation here
User is offlineProfile CardPM
+Quote Post

ajaymatrix
RE: Linked List Question!
1 Oct, 2007 - 07:03 PM
Post #5

D.I.C Regular
Group Icon

Joined: 15 May, 2007
Posts: 389



Thanked: 1 times
Dream Kudos: 100
My Contributions
that tutorial helps a lot..
User is offlineProfile CardPM
+Quote Post

nirvanarupali
RE: Linked List Question!
1 Oct, 2007 - 07:05 PM
Post #6

D.I.C Foot
Group Icon

Joined: 1 Aug, 2007
Posts: 983



Thanked: 2 times
Dream Kudos: 375
My Contributions
icon_up.gif
User is offlineProfile CardPM
+Quote Post

marckiestar
RE: Linked List Question!
1 Oct, 2007 - 07:45 PM
Post #7

New D.I.C Head
*

Joined: 21 Aug, 2007
Posts: 21



Thanked: 1 times
My Contributions
Hi everyone!
Thank You for your reply........ But its really difficult ot understand the tutorials.....we are using borland c++ 1991 and it doesn't use using namespace and whatsoever...... could you translate the tutorial using the header files conio.h, iostrem.h, stdlib.h, stdio.h?

thank you for your reply.......
User is offlineProfile CardPM
+Quote Post

nirvanarupali
RE: Linked List Question!
1 Oct, 2007 - 07:57 PM
Post #8

D.I.C Foot
Group Icon

Joined: 1 Aug, 2007
Posts: 983



Thanked: 2 times
Dream Kudos: 375
My Contributions
Download the latest version of Borland. I am using Borland 5.5 and it supports the latest ISO.

Linked List Implementation is Intermediate,I guess. One way of learning is reading the tutorial. smile.gif
User is offlineProfile CardPM
+Quote Post

marckiestar
RE: Linked List Question!
1 Oct, 2007 - 07:57 PM
Post #9

New D.I.C Head
*

Joined: 21 Aug, 2007
Posts: 21



Thanked: 1 times
My Contributions
born2c0de are you saying that you declare all the possible content of the node inside the struct on the top, then when you enter the values, it may look like this?
int x;
char y;
when inputting content of the node:
p->next->x=123;
p->next->y=h;

could p->next appear at the same time?

User is offlineProfile CardPM
+Quote Post

marckiestar
RE: Linked List Question!
1 Oct, 2007 - 08:06 PM
Post #10

New D.I.C Head
*

Joined: 21 Aug, 2007
Posts: 21



Thanked: 1 times
My Contributions
nirvanarupali the compiler we are using at school is borland c++ 1991 and we could not modify that


nirvanarupali taga philippines ka din pala..... taga san ka....alam mo magtagalog?

User is offlineProfile CardPM
+Quote Post

nirvanarupali
RE: Linked List Question!
1 Oct, 2007 - 08:19 PM
Post #11

D.I.C Foot
Group Icon

Joined: 1 Aug, 2007
Posts: 983



Thanked: 2 times
Dream Kudos: 375
My Contributions
Cebu City. We can't speak our language here. Avoid that, we are composed of international members here.

Try to convinced you school professor or administrator to change your old compiler, it would be a big mess if you are studying C++, the old way, I mean not in ISO. You are not in the right track.

Try the link which I give above. I learned a lot from that.
User is offlineProfile CardPM
+Quote Post

marckiestar
RE: Linked List Question!
1 Oct, 2007 - 08:23 PM
Post #12

New D.I.C Head
*

Joined: 21 Aug, 2007
Posts: 21



Thanked: 1 times
My Contributions
nirvanarupali can you give me a sample code the one that is easy to understand... a code in your own way....just a bit.....please... im just a beginner....by the way how old r u? Im just 17
User is offlineProfile CardPM
+Quote Post

2 Pages V  1 2 >
Reply to this topicStart new topic
Time is now: 12/1/08 08:34AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month