By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,496 Members | 2,325 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,496 IT Pros & Developers. It's quick & easy.

Insert items in different functino ?

P: n/a
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;
}

Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Kay" <er*********@yahoo.com.hk> wrote in message
news:41************@yahoo.com.hk...
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
Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.