Two Plus Two Newer Archives

Two Plus Two Newer Archives (http://archives1.twoplustwo.com/index.php)
-   Computer Technical Help (http://archives1.twoplustwo.com/forumdisplay.php?f=50)
-   -   C Programming Halp! :) (http://archives1.twoplustwo.com/showthread.php?t=501864)

IRuleYouHard 09-15-2007 05:39 PM

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]

LeapFrog 09-15-2007 06:01 PM

Re: C Programming Halp! :)
 
This looks suspiciously like homework. Unless... you work for a car dealership?

IRuleYouHard 09-15-2007 06:07 PM

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

thedustbustr 09-15-2007 06:10 PM

Re: C Programming Halp! :)
 
how much money are you shipping to my FTP account if I help?

IRuleYouHard 09-15-2007 06:12 PM

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

thedustbustr 09-15-2007 06:15 PM

Re: C Programming Halp! :)
 
post your source in |code| |/code| tags so the array indexing doesn't turn into italics

goofyballer 09-15-2007 06:19 PM

Re: C Programming Halp! :)
 
And so that there's some [censored] indentation

IRuleYouHard 09-15-2007 06:22 PM

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 &lt; plist-&gt;count; i++)
{
if (EQ(targetYear, plist-&gt;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 />

IRuleYouHard 09-15-2007 06:26 PM

Re: C Programming Halp! :)
 
<font class="small">Code:</font><hr /><pre>
typedef enum boolean
{FALSE, TRUE}
BOOLEAN;
</pre><hr />
if that helps any.

bluey 09-15-2007 06:49 PM

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


All times are GMT -4. The time now is 12:15 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.