Rules | Recent posts | topic RSS | Search | Register  | Log in

help C

 
Post new topic  Reply to topic    EDAboard.com Forum Index -> PC Programming and Interfacing
Author Message
Mejdi_tn



Joined: 20 Oct 2007
Posts: 27
Helped: 1


Post04 Mar 2008 16:01   help C

hi
i need programm that seeks two maximum in a array and memorise there position
thing you
Back to top
kiprono



Joined: 18 Nov 2005
Posts: 235
Helped: 15
Location: Nairobi


Post05 Mar 2008 21:43   Re: help C

Search for binary search programs on Google.
Back to top
wtl



Joined: 15 Feb 2008
Posts: 7


Post07 Mar 2008 14:31   Re: help C

Maybe this can help: http://www.thescripts.com/forum/thread216170.html
Back to top
jhbbunch



Joined: 21 Feb 2006
Posts: 208
Helped: 14


Post07 Mar 2008 19:36   Re: help C

Is this what you mean?:

for (i = 0; i > arraylength; i++)
{
if (array[i] > max1_index)
{
temp = max1_index;
max1_index= i;
max2_index = temp;
}
else if (array[i] > max2_index)
max2_index = i;
}
Back to top
kiprono



Joined: 18 Nov 2005
Posts: 235
Helped: 15
Location: Nairobi


Post08 Mar 2008 9:09   Re: help C

Thats cool for a start!
Back to top
mmelek1



Joined: 20 Apr 2002
Posts: 120
Helped: 3


Post30 Apr 2008 6:59   Re: help C

jhbbunch wrote:
Is this what you mean?:

for (i = 0; i > arraylength; i++)
{
if (array[i] > max1_index)
{
temp = max1_index;
max1_index= i;
max2_index = temp;
}
else if (array[i] > max2_index)
max2_index = i;
}


First, you need to set max1_index, otherwise you can't say if (array[i] > max1_index)
Back to top
Post new topic  Reply to topic    EDAboard.com Forum Index -> PC Programming and Interfacing
Page 1 of 1 All times are GMT + 2 Hours


Abuse
Administrator
Moderators
topic RSS 
sitemap