⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 write.c

📁 Trees are natural structures for representing certain kinds of hierarchical data. A (rooted) tree co
💻 C
字号:
#include <stdio.h>#include "Tree.h"void WriteTreeSlave( Tree T, int indent )                         /*L.Allison*//* Write a tree, with root at the LHS, by a right-to-left, infix traversal */ { int i;  char str[]="----------|";   if( T != NULL )    { WriteTreeSlave(T->right, indent+1);      for(i=0; i < indent; i++) printf("          |");      sprintf(str, "%s", T->elt);      /* NB. assumed to be a Tree of String */      i = 0;      while( str[i] != NULL ) i++;      if( i > 0 && i < 10 && str[i-1] == '-' )         { str[i]=' '; i++; } /* let '-' signs stand out */      while( i < 10 ) { str[i]='-'; i++; }      str[i] = '|'; str[i+1] = NULL;      printf("%s\n", str);      WriteTreeSlave(T->left, indent+1);    } }/*WriteTreeSlave*/void WriteTree( Tree T ) { WriteTreeSlave(T, 0); }/* Write a Tree down the page. */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -