Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > Other Topics > Computer Technical Help
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-15-2007, 05:39 PM
IRuleYouHard IRuleYouHard is offline
Senior Member
 
Join Date: Nov 2006
Location: MS Paint Forum.
Posts: 1,050
Default 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]
Reply With Quote
  #2  
Old 09-15-2007, 06:01 PM
LeapFrog LeapFrog is offline
Senior Member
 
Join Date: Oct 2006
Location: Mystery time!
Posts: 1,173
Default Re: C Programming Halp! :)

This looks suspiciously like homework. Unless... you work for a car dealership?
Reply With Quote
  #3  
Old 09-15-2007, 06:07 PM
IRuleYouHard IRuleYouHard is offline
Senior Member
 
Join Date: Nov 2006
Location: MS Paint Forum.
Posts: 1,050
Default 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...
Reply With Quote
  #4  
Old 09-15-2007, 06:10 PM
thedustbustr thedustbustr is offline
Senior Member
 
Join Date: Sep 2005
Posts: 8,556
Default Re: C Programming Halp! :)

how much money are you shipping to my FTP account if I help?
Reply With Quote
  #5  
Old 09-15-2007, 06:12 PM
IRuleYouHard IRuleYouHard is offline
Senior Member
 
Join Date: Nov 2006
Location: MS Paint Forum.
Posts: 1,050
Default 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
Reply With Quote
  #6  
Old 09-15-2007, 06:15 PM
thedustbustr thedustbustr is offline
Senior Member
 
Join Date: Sep 2005
Posts: 8,556
Default Re: C Programming Halp! :)

post your source in |code| |/code| tags so the array indexing doesn't turn into italics
Reply With Quote
  #7  
Old 09-15-2007, 06:19 PM
goofyballer goofyballer is offline
Senior Member
 
Join Date: Jun 2005
Location: THESE IZ THE OLD FORUMZ
Posts: 7,108
Default Re: C Programming Halp! :)

And so that there's some [censored] indentation
Reply With Quote
  #8  
Old 09-15-2007, 06:22 PM
IRuleYouHard IRuleYouHard is offline
Senior Member
 
Join Date: Nov 2006
Location: MS Paint Forum.
Posts: 1,050
Default 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 />
Reply With Quote
  #9  
Old 09-15-2007, 06:26 PM
IRuleYouHard IRuleYouHard is offline
Senior Member
 
Join Date: Nov 2006
Location: MS Paint Forum.
Posts: 1,050
Default Re: C Programming Halp! :)

<font class="small">Code:</font><hr /><pre>
typedef enum boolean
{FALSE, TRUE}
BOOLEAN;
</pre><hr />
if that helps any.
Reply With Quote
  #10  
Old 09-15-2007, 06:49 PM
bluey bluey is offline
Senior Member
 
Join Date: Mar 2006
Posts: 878
Default 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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:58 PM.


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