| Author |
Message |
Mejdi_tn
Joined: 20 Oct 2007 Posts: 27 Helped: 1
|
04 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
|
05 Mar 2008 21:43 Re: help C |
|
|
|
| Search for binary search programs on Google.
|
|
| Back to top |
|
 |
wtl
Joined: 15 Feb 2008 Posts: 7
|
|
| Back to top |
|
 |
jhbbunch
Joined: 21 Feb 2006 Posts: 208 Helped: 14
|
07 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
|
08 Mar 2008 9:09 Re: help C |
|
|
|
| Thats cool for a start!
|
|
| Back to top |
|
 |
mmelek1
Joined: 20 Apr 2002 Posts: 120 Helped: 3
|
30 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 |
|
 |