1 # include<iostream> 2 # include<cstdio> 3 using namespace std; 4 void visit(int e) 5 { 6 printf("%d ",e); // 以整型格式输出 7 } 8 void mid(int treenode) 9 { 10 if (treenode > 5) 11 return; 12 visit(treenode); /*访问treenode节点*/ 13 mid(treenode * 2); 14 mid(treenode*2 + 1); 15 } 16 int main() 17 { 18 mid(1); 19 }
转载于:https://www.cnblogs.com/sxmcACM/p/3467924.html