1 2 3 4 5 6 7 8 9 10 11 12 #include < stdio.h > void hanoi_tower( int n, char from, char tmp, char to){ if (n > 0 ){ hanoi_tower(n - 1 , from, to, tmp); printf ( "원판 %d을 %c에서 %c으로 옮긴다.\n" ,n,from,to); hanoi_tower(n - 1 , tmp, from, to); } } main(){ hanoi_tower( 5 , 'A' , 'B' , 'C' ); } Colored by Color Scripter cs 실행화면
오름차순은 arr[j] < arr[j+1]을 arr[j] > arr[j+1]로 바꿔주시면 됩니다.
답글삭제