#include <iostream.h>
void printArray(int a[])
{
int k;
for(k=0;k<10;k++)
cout << a[k] << " ";
cout << endl;
}
int main()
{
int a[10] = {1,3,2,4,8,7,5,10,9,6};
int i,j;
printArray(a);
int min,pos;
for(i=0;i<9;i++)
{
min = a[i];
pos = i;
for(j=i;j<9;j++)
{
if(a[j] < min)
{
min = a[j];
pos = j;
}
}
int t = a[i];
a[i] = a[pos];
a[pos] = t;
}
printArray(a);
}
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2009
(46)
-
▼
January
(13)
- Wipeer set as default page for new tabs in firefox
- Some useful vim commands
- launching multiple commands(applications) from a b...
- command for traceroute on windows
- Oracle 10g username password
- flex sorting a datagrid column numerically rather ...
- flex datagrid restricting a column to have numeric...
- flex datagrid with total max average etc
- Inverse ,determinant ,adjoint for NxN matrix
- Bunch tag
- C code for selection Sort
- C code for insertion sort
- C code for bubble sort
-
▼
January
(13)
No comments:
Post a Comment