#include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
int move(int n,char x,char y,char z);
printf("inter your number\n");
scanf("%d",&n);
move(n,‘a‘,‘b‘,‘c‘);
return 0;
}
int move(int n,char x,char y,char z){
if(n==1){
printf("%c-->%c\n",x,z);
}
else{
move(n-1,x,z,y);
printf("%c-->%c\n",x,z);
move(n-1,y,x,z);
}
}
原文地址:http://blog.51cto.com/13688928/2094652