| | |
Linked List Retrieve Method
![]() |
•
•
Join Date: May 2005
Posts: 42
Reputation:
Solved Threads: 0
what I am trying to do is retrive the "status" back to my main prog of the status of a patient.
I thought it was a simple case of S.retrieve(index of person I was looking for) and I would recive the status (which is an integer) back to my main function. everytime I try to complie it will not compile. Any suggestions on how to tackle it?
Patient P; declaration of object
Sequence S; declaration of patient
I have a patient object with methods
void patient::set_status(int aStatus)
{
status=aStatus;
}
int patient::get_status()
{
return status;
}
I have a Linked list with method
SeqItemType Sequence::retrieve(int index)
{
if ((index < 1) || (index > size())){
// can't retrieve something that isn't there
}
ListNode *cur = find(index);
return cur->item.get_status();
}
I thought it was a simple case of S.retrieve(index of person I was looking for) and I would recive the status (which is an integer) back to my main function. everytime I try to complie it will not compile. Any suggestions on how to tackle it?
Patient P; declaration of object
Sequence S; declaration of patient
I have a patient object with methods
void patient::set_status(int aStatus)
{
status=aStatus;
}
int patient::get_status()
{
return status;
}
I have a Linked list with method
SeqItemType Sequence::retrieve(int index)
{
if ((index < 1) || (index > size())){
// can't retrieve something that isn't there
}
ListNode *cur = find(index);
return cur->item.get_status();
}
•
•
Join Date: May 2005
Posts: 42
Reputation:
Solved Threads: 0
I figured this one out myself or should I say the solution works!!!
Change SeqItemType to an int. then the method will return an int which is what i wanted and I can use an if/case statement from here.
SeqItemType Sequence::retrieve(int index)
{
if ((index < 1) || (index > size())){
// can't retrieve something that isn't there
}
ListNode *cur = find(index);
return cur->item.get_status();
}
Change SeqItemType to an int. then the method will return an int which is what i wanted and I can use an if/case statement from here.
SeqItemType Sequence::retrieve(int index)
{
if ((index < 1) || (index > size())){
// can't retrieve something that isn't there
}
ListNode *cur = find(index);
return cur->item.get_status();
}
![]() |
Similar Threads
- remove method linked list (C)
- linked list small problem with Insert Function (C++)
- Link List Move Method (C)
- recursive linked list (C++)
- help with adding items to a linked list. (Java)
Other Threads in the C Forum
- Previous Thread: Link List Move Method
- Next Thread: Problem with precedence in C
| Thread Tools | Search this Thread |
* adobe ansi api array asterisks binarysearch calculate centimeter char character cm convert copyanyfile copyimagefile copypdffile cprogramme createcopyoffile createprocess() csyntax directory feet fflush fgets file floatingpointvalidation fork frequency function getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux hacking highest homework i/o inches infiniteloop interest intmain() kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives match meter microsoft mqqueue mysql number oddnumber odf open opendocumentformat openwebfoundation owf pattern pdf performance posix power probleminc program programming pyramidusingturboccodes read recv recvblocked repetition scanf scheduling segmentationfault send single socketprograming socketprogramming stack standard strchr string suggestions systemcall unix urboc user variable voidmain() wab whythiscodecausesegmentationfault win32api windows.h





