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

wrting function using pointers and list

P: n/a
hi i have hw assignment providing info below. please provide some code if
you can. thanks.
int lookupValue(List *listPtr, ListItemType item, bool &success)
// If an entry equal to item exists in the list pointed to by
// listPtr, returns the index of the position of the first occurrence
// of such an item and sets success to true. Otherwise success is set
// to false and -1 is returned.

void testLookupValue()
// Tests function lookupValue. Initializes a list using enterList,
// asks for a value to look up, and then passes them to lookupValue.
// If the value is found, prints the location in the list. Otherwise
// prints a message saying the value was not found.

Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a

"chirag" <ch*******@yahoo.com> wrote in message
news:0b******************************@localhost.ta lkaboutprogramming.com...
hi i have hw assignment providing info below. please provide some code if
you can. thanks.


Nope. Try it yourself. That's what homework is for. If you get stuck on
some particular piece of code you've written, post it and we'll help point
out what's wrong and how you might fix it. But we don't do homework. That
doesn't help anyone.

-Howard
Jul 23 '05 #2

P: n/a
can you at least provide me some guidelines to start with cuz this is only
part of my hw assignment and this is the only one part wher i m stuck.
thanks.

Jul 23 '05 #3

P: n/a
chirag wrote:
can you at least provide me some guidelines to start with cuz this is only part of my hw assignment and this is the only one part wher i m stuck. thanks.


Nope. Show us what you have so far. What exactly is giving you trouble?
Do you know what a linked list is? How to traverse one? Compare
elements?

Note that we don't even have the definition for the list type.


Brian

Jul 23 '05 #4

P: n/a

"chirag" <ch*******@yahoo.com> wrote in message
news:e0******************************@localhost.ta lkaboutprogramming.com...
can you at least provide me some guidelines to start with cuz this is
only
part of my hw assignment and this is the only one part wher i m stuck.
thanks.


You don't say where you are stuck. Do you have any code at all? Do you
know how to ask for data, how to read it in, and how to print out the
asnwer? Do you know how to create the list? Do you know how to search it?
We really can't help with such a vague question. For help with the problem
itself, you might ask someone in your class how they're doing it, or ask the
instructor for guidance. And if you have a question about something
*specific*, then ask it. (Books are also a great place to find specific
answers, as is the FAQ I already mentioned.)

By the way, it would also help if you used complete words (and punctuation
as well), instead of saying things like "wher i m stuck". This isn't Instant
Messenger, it's a newsgroup.

-Howard


Jul 23 '05 #5

P: n/a

"chirag" <ch*******@yahoo.com> wrote in message
news:0b******************************@localhost.ta lkaboutprogramming.com...
hi i have hw assignment providing info below. please provide some code if
you can. thanks.
int lookupValue(List *listPtr, ListItemType item, bool &success)
// If an entry equal to item exists in the list pointed to by
// listPtr, returns the index of the position of the first occurrence
// of such an item and sets success to true. Otherwise success is set
// to false and -1 is returned.
Just to get you going...
What would your List parameter and ListItemType look like?



void testLookupValue()
// Tests function lookupValue. Initializes a list using enterList,
// asks for a value to look up, and then passes them to lookupValue.
// If the value is found, prints the location in the list. Otherwise
// prints a message saying the value was not found.


Do you have the code for enterList???
Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.