#include using namespace std; void Bubble(int x[], int n) { int hold, j, pass; int switched = true; for (pass = 0; pass < n - 1 && switched == true; pass++) { //outer loop controls the number of passes switched = false; for (j = 0; j < n - pass - 1; j++) { //inner loop controls each individual pass if (x[j] > x[j + 1]) //elements out of order { switched = true; hold = x[j]; x[j] = x[j + 1]; x[j + 1] = hold; } //end if } //end inner for loop } //end outer forloop } //end bubble int main() { int N[] = { 20000,5000,100,10,10000,50000,1000 }; Bubble(N, 7); for (int i = 0; i < 7; i++) { cout << " " << N[i] << " "; } }