How to Descending This Sort??(Important!)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<iostream.h>															//NAMA = STEVEN CHANDRA
#include<iomanip.h>																//NIM = 0101120129
void main()																		//TUGAS = SELECTION SORT CHARACTER DESCENDING
{
	char Array[10]={'a','b','c','d','e','f','g','h','i','j'};
	int i,j,smalltest,temp;
	cout<<"Masukkan Abjad Secara Acak Dari A-J!!!"<<endl;
	for (int a=0; a<=9; a++)
	{
		cout<<"Abjad "<<a + 1<<" : ";
		cin>>Array[a];
	}
	cout<<"Data sebelum di urutkan:\n\n";
	for(int k=0;k<=9;k++)
	{
		cout<<setw(3)<<Array[k];
	}
	for(i=0;i<=9;i++)
	{
		smalltest=i;
		for(j=i+1;j<=9;j++)
		{
			if(Array[smalltest]>Array[j])
			{
				smalltest=j;
			}
		}
		temp=Array[i];
		Array[smalltest]=Array[i];
		Array[smalltest]=temp;
	}
	cout<<"\n\nData setelah di urutkan:\n\n";
	for(int l=0;l<=9;l++)
	{
		cout<<setw(3)<<Array[l];
	}
	cout<<"\n\n";
}


IT WAS STILL ASCENDING,I JUST WANT TO MAKE IT DESCEND,ANY HELP? :)
Did you write this code yourself? You don't seem to understand how it works... There is only one symbol enforcing order. That is >. I wonder what would happen if you changed it...
The meaning of the word "descending" and the meaning of the word and "ascending" : NEGATIVE
So it's a big hint, try yourself. :)
Note : They are related to "comparison".
sort | rev
Topic archived. No new replies allowed.