Linked List inside a linked list List...
Good morning
I want to build a linked list in a linked list
I don't want to use #include<list> but the old way of Linked list.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include <iostream>
using namespace std;
typedef struct Gas_Station
{
int data;
Gas_Station *Next;
Person* ptr_2_Person;
}Gas_Station;
typedef struct Person
{
char name[20];
int age;
Person* Next_person;
}Person;
int main()
{
Gas_Station* Head=NULL;
for(int i =0 ; i<5 ; i++)
{
cout<<"Enter data"<<endl;
Gas_Station* tmp=new Gas_Station;
cin>>(tmp->data);
tmp->Next=Head;
Head=tmp;
}
return 0;
}
| |
I draw what I mean so you can look and understand
http://www.up2me.co.il/images/67636385.png
So if you can write down what I need 2 add I'll be glad :)
Thanks a lot!
Last edited on
The question is, what do you want to add?
Topic archived. No new replies allowed.