#include using namespace std; int main() { const int N = 10; int a[N]; int end; bool sorted = false; srand(time(0)); for (int i = 0; i < N; i++) { a[i] = rand()%20; cout << a[i] <<" "; } cout << endl; end = N; while (!sorted) { sorted = true; end--; for (int i = 0; i < end; i++) if (a[i] > a[i+1] ) { int temp = a[i]; a[i] = a[i+1]; a[i+1] = temp; sorted = false; }//if }//end while for (int i = 0; i < N; i++) cout << a[i] <<" "; cout << endl; system("pause"); return 0; }