# include void main() { void hanoi(int n,char one,char two,char three); int m; printf(\"input the number of diskes:\"); scanf(\"%d\ printf(\"The step to move %d diskes:\\n\ hanoi(m,'A','B','C'); } void hanoi(int n,char one,char two,char three) { void move(char x,char y); if(n == 1){ move(one,three); } else{ hanoi(n-1,one,three,two); move(one,three); hanoi(n-1,two,one,three); } } void move(char x,char y) { printf(\"%c-->%c\\n\ } 实验结果 因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- huatuo8.com 版权所有 湘ICP备2023022238号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务