bubble sort in c++
bubble sort in c++
**** you fergwad
heres your basic bubble sort in c++.
I got it off this site if you want more information:Code:void bubbleSort1(int x[], int n) { for (int pass=1; pass < n; pass++) // count how many times { // This next loop becomes shorter and shorter for (int i=0; i < n-pass; i++) { if (x[i] > x[i+1]) { // exchange elements int temp = x[i]; x[i] = x[i+1]; x[i+1] = temp; } } } }
http://leepoint.net/notes/cpp/index.html
the best things in life are simple.