how to bulid

hi i wanna ask i have a single linked list i bulid it
how can enter a name and id and sallary how the code will lock like when insert it to the linked list function
how can enter a name and id and sallary

http://www.google.co.uk/search?hl=en&source=hp&fkt=416&fsdt=4058&q=C%2B%2B+input%2Foutput
Results in
http://www.cplusplus.com/doc/tutorial/basic_io/ as the third page.

To elaborate; you need to get some input with std::cin or std::getline() and then you need to do your linked list stuff based on that.

how the code will lock like when insert it to the linked list function

How could a person possibly know what it will look like without being able to see what your linked list looks like?
Last edited on
i ask how i will insert theme and send theme to the linked list
i ask how i will insert theme and send theme to the linked list


What do you mean by theme? You're going to need to post some code for this to make sense to anyone.
sturuct linked list
{


}

insertfunction( //how i will get the info i want to enter here)
{
//codeing for make node how i will save to what i will enter

}
i think it will looks like this:

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
...
struct linked_list{
int id;
string name;
double salary;
linked_list * pNext;
};

linked_list * pMyLinkedList;

bool insert(int id, string name, double salary)
{

linked_list * tmp;
tmp = pMyLinkedList;

while(tmp) //find place where new node must be added
{
tmp = tmp->pNext;
}

tmp = (linked_list*) calloc(1, sizeof(linked_list));
tmp->id = id;
tmp->name= name;
tmp->salary= salary;
tmp->pNext = NULL;
}

....


i think, the code will be like this, but i don't test it
Topic archived. No new replies allowed.