#1
|
|||
|
|||
C Programming Halp! :)
BOOLEAN SequentialSearch(ARRAY_LIST *plist, YEAR targetYear, int *loc)
{ int i; /* loop control variable */ int numFound; /* counts how many found */ BOOLEAN found; /* return value TRUE if success FALSE if not */ numFound = 0; /* set to none in the beginning */ found = FALSE; /* initial setting until a record is found */ /* search through the array list for targets */ for(i = 0; i < plist->count; i++) { if (EQ(targetYear, plist->car[i].year)) /* target year is found */ { loc = loc; numFound++; /* add one to the count */ /* ******** HERE IS WHERE YOU WILL WANT TO HANDLE DISPLAYING THE CAR RECORD. EITHER DIRECTLY, OR BY CALLING A FUNCTION TO DO IT ********* */ found = TRUE; /* successfully found at least one record */ } } printf("\n\n %d record(s) found that match\n", numFound); i = 0; /* reset value of i */ return found; } This is the function I am calling... the only problem is I don't know what to send it exactly. Who wants to help? [img]/images/graemlins/smile.gif[/img] |
#2
|
|||
|
|||
Re: C Programming Halp! :)
This looks suspiciously like homework. Unless... you work for a car dealership?
|
#3
|
|||
|
|||
Re: C Programming Halp! :)
Its a program assignment... about 1/15th of it. It is an online class so I don't really know how to find my answers out...
|
#4
|
|||
|
|||
Re: C Programming Halp! :)
how much money are you shipping to my FTP account if I help?
|
#5
|
|||
|
|||
Re: C Programming Halp! :)
[ QUOTE ]
how much money are you shipping to my FTP account if I help? [/ QUOTE ] $5? I R BUSTO! EDIT: and a pic of my penis |
#6
|
|||
|
|||
Re: C Programming Halp! :)
post your source in |code| |/code| tags so the array indexing doesn't turn into italics
|
#7
|
|||
|
|||
Re: C Programming Halp! :)
And so that there's some [censored] indentation
|
#8
|
|||
|
|||
Re: C Programming Halp! :)
<font class="small">Code:</font><hr /><pre>
BOOLEAN SequentialSearch(ARRAY_LIST *plist, YEAR targetYear, int *loc) { int i; /* loop control variable */ int numFound; /* counts how many found */ BOOLEAN found; /* return value TRUE if success FALSE if not */ numFound = 0; /* set to none in the beginning */ found = FALSE; /* initial setting until a record is found */ /* search through the array list for targets */ for(i = 0; i < plist->count; i++) { if (EQ(targetYear, plist->car[i].year)) /* target year is found */ { loc = loc; numFound++; /* add one to the count */ /* ******** HERE IS WHERE YOU WILL WANT TO HANDLE DISPLAYING THE CAR RECORD. EITHER DIRECTLY, OR BY CALLING A FUNCTION TO DO IT ********* */ found = TRUE; /* successfully found at least one record */ } } printf("\n\n %d record(s) found that match\n", numFound); i = 0; /* reset value of i */ return found; } </pre><hr /> |
#9
|
|||
|
|||
Re: C Programming Halp! :)
<font class="small">Code:</font><hr /><pre>
typedef enum boolean {FALSE, TRUE} BOOLEAN; </pre><hr /> if that helps any. |
#10
|
|||
|
|||
Re: C Programming Halp! :)
1. that is really [censored] ugly
2. do you really comment every [censored] line? 3. send it this [censored] ARRAY_LIST *plist, YEAR targetYear, int *loc |
Thread Tools | |
Display Modes | |
|
|