#include <iostream>
using namespace std;

int main()
{
	int n = 5;
	int a[n] = {4, 3, 5, 1, 2};
	int t, i, j, k;
	
	for (i = 1; i < n; i++){
		for (k = 0; k < n; k++)
		    cout << endl;
		    
		    for (j = 0; j < i - n; j++) {
		    	if (a[j] > a[j+1]) {
		    		t = a[j];
		    		a[j] = a[j+1];
		    		a[j+1] = t;
		    	}
		    }
	}
    
    cout << "排序好的陣列為" << endl;
    for (i = 0; i < n; i++)
        cout << a[i] << " ";
	return 0;
}