473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

wrting function using pointers and list

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
5 1287

"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
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
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

"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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: nightflyer | last post by:
Hi all, [code snippet appended at the end.) my question: A class has a few string variables with not know length at design time. Now I declare lets say a 1000 of those classes and put them...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
2
by: sci | last post by:
class A; void function(vector<A>* l) { .... } main(){ vector<A> aAList; function(&aAList);
4
by: Christian Christmann | last post by:
Hi, I've some old code which I would like to replace by STL. It's a self-written double linked list which consists of instances of another class Element which contains the information as void*...
10
by: gmtonyhoyt | last post by:
It's been mentioned to me that, in standard c, that you can have structures behave very much like classes in relation to something to do with function calls within a structure. Now, I didn't get...
5
by: DevarajA | last post by:
I'd like to create a linked list or a simple array of pointers to function, but I can't find out how. I'm trying to do it like this: struct fn_pointer{ void *pt_; /*the address*/ char...
6
by: M Turo | last post by:
Hi, I was wondering if anyone can help. I'm want to pre-load a 'table' of function pointers that I can call using a its arrayed index, eg (non c code example) pFunc = func_A; pFunc = func_B;
19
by: Adam | last post by:
Hi, I'd like to return an (arbitrary length) string array from a function so that after calling the array I've got a list of strings I can access. After much perusing of the internet I found a...
25
by: hifrnds007 | last post by:
how the function poiners avoids the usage of switch cases?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.