Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: C++  |  size: 0.26 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. void selection(double a[], unsigned long N) {
  2.   int i, j, min;
  3.   double t;
  4.  
  5.   for (i=0; i < N-1; i++) {
  6.     min = i;
  7.     for (j= i + 1; j < N; j++)
  8.       if (a[j] < a[min])
  9.         min = j;
  10.  
  11.     t = a[min];
  12.     a[min] = a[i];
  13.     a[i] = t;
  14.   }
  15. }