On Oct 21, 9:12 am, Clinto <(EMail Removed)> wrote:
> On Oct 21, 3:34 am, Army1987 <(EMail Removed)> wrote:
>
>
>
>
>
> > On Sun, 21 Oct 2007 00:10:27 0700, Clinto wrote:
> > > Hello,
>
> > > I am using the below code to sort an array in ascending order, I also
> > > need to sort in descending order. I cannot get figure out what has to
> > > change to make this happen. If someone could *point me in the right
> > > direction, it would be appreciated.
>
> > Have you tried to do the most obvious thing to do, namely writing
> > a greatest() function identical to smallest() except using a > in
> > the place of a <, and using it instead of smallest()? If so, what
> > was wrong with the results you got? If not, did you bother to try
> > and figure out how those functions work?
> > 
> > Army1987 (Replace "NOSPAM" with "email")
> > A hamburger is better than nothing.
> > Nothing is better than eternal happiness.
> > Therefore, a hamburger is better than eternal happiness.
>
> I did make a new selectsort() function and similar function to
> smallest() which i called largest() and switched the <. I made changes
> in the selectsort function as well. (maybe that is my problem) My
> output was the same as what was passed to it. So I know I am doing
> somehthing incorrectly. I see what the function does to get the
> smallest items in the array and sort them in ascending order. I just
> do not quite understand how to change it to descending order. I am
> sure you can tell this is a homework assignment so I am not asking
> anyone to do it for me.
>
> I just need some help as I have spent too many hours on it already.
> Thanks for all input, I will work with the suggestions given thus far.
> I will rewrite the functions later today. I have church this morning. Hide quoted text 
>
>  Show quoted text 
I rewrote the sort functions and finally got it to work:
5 numbers read.
Your data sorted are:
Ascending Original Descending
14 26 57
26 14 41
33 57 33
41 33 26
57 41 14
End of List
Thanks for the assistance.
