2012年8月25日

汉诺塔递归和非递归算法实现

摘要: /*汉诺塔递归和非递归算法实现*/#include <iostream>using namespace std;void fun(int N,char a,char b,char c)//递归算法{ if (N==1) { cout<<a<<"-->"<<c<<endl; return; } fun(N-1,a,c,b); cout<<a<<"-->"<<c<<endl; fun(N-1,b,a,c);}void main(){ fun 阅读全文

posted @ 2012-08-25 20:07 为梦飞翔 阅读(4414) 评论(0) 推荐(0)

导航