#include "..\CookHeader.h"

Array <int> moneyAry = { 7, 5, 11, 6, 9, 80000, 10, 6, 15, 12 };

Array <int> selctionSort(Array <int> ary) {
	int n = len(ary);
	for (int cycle = 0; cycle < n - 1; cycle++) {
		int minIdx = cycle;
		for (int i = cycle+1; i < n; i++) {
			if (ary[minIdx] > ary[i])
				minIdx = i;
		}
		int tmp = ary[cycle];
		ary[cycle] = ary[minIdx];
		ary[minIdx] = tmp;
	}
	return ary;
}

int main() {
	print("용돈 정렬 전 -->");
	printArray(moneyAry);
	moneyAry = selctionSort(moneyAry);
	print("용돈 정렬 후 -->");
	printArray(moneyAry);
	print("용돈 중앙값 -->");
	println(moneyAry[ len(moneyAry) / 2] );
}