Insert items in different functino ?

K

Kay

I have a problem in inserting items in linked list. Hence, there are
different way to insert the items to the list. The first one is loading
data form a txt file(1). And the second one is input from keyboard. I
have done the first part. I have got a question in second part. Do I
need to continue the insertion by using the (1) linked list and its
position ? If yes, how to return the ptr and list position ?

Can I do sth like this ? If yes, how can I call back the same list and
oposition in other methods. If no, how can I insert other new items in
the same list by using keyboard ?

List * ReturnPtr( List * l){
return l;
}

Positino ReturnPositino( Position p){
return p;
}
 
J

John Harrison

Kay said:
I have a problem in inserting items in linked list. Hence, there are
different way to insert the items to the list. The first one is loading
data form a txt file(1). And the second one is input from keyboard. I
have done the first part. I have got a question in second part. Do I
need to continue the insertion by using the (1) linked list and its
position ? If yes, how to return the ptr and list position ?

Can I do sth like this ? If yes, how can I call back the same list and
oposition in other methods. If no, how can I insert other new items in
the same list by using keyboard ?

List * ReturnPtr( List * l){
return l;
}

Positino ReturnPositino( Position p){
return p;
}

Both your functions do nothing at all, they just return the same argument
that is passed in. They are legal but they aren't going to help solve
whatever problem it is that you are facing.

It's hard to understand but you seem to have some sort of design problem. It
should not matter when inserting some data into a linked list whether that
data comes from a file or from a keyboard, the same method should work for
both cases. But maybe you have designed your classes wrongly so that it
doesn't. In fact maybe that is the point of the exercise, to show how badly
designed classes are awkward to work with.

I think to get some help you are going to have to show some of the code you
have written and explain why things aren't working as they are. I think you
are asking the wrong questions at the moment.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,175
Messages
2,570,947
Members
47,498
Latest member
yelene6679

Latest Threads

Top