Develop
2003.04.23 09:46

[c] 하노이탑 - 재귀함수

Views 9153 Votes 0 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

Tower of Hanoi - Recursive

#include<stdio.h>

void move(int n, char from, char to, char c)
{
    if(n>0){
        move(n-1,from,c,to);
        printf("%d 디스크를 %c에서 %c로 이동n",n,from,to);
        move(n-1,c,to,from);
    }
}

void main()
{
    int n;

    printf("몇개의 디스크 입니까? : ");
    scanf("%d",&n);
    move(n,'L','R','C');
}




?

No Articles

Board Pagination Prev 1 ... 70 71 72 73 74 Next
/ 74