void Bintree::showtree(leaf* root, int xnew, int ynew, double level) { ++level; int xleft, xright, y; quant(xnew, ynew, xleft, xright, y, root->number, level, root->color); if (root->childleft != nullptr) showtree(root->childleft, xleft, y, level); if (root->childright != nullptr) showtree(root->childright, xright, y,level); }
void cmdloop(int top) { union node *n; struct stackmark smark; int inter; int numeof = 0; enum skipstate skip; CTRACE(DBG_ALWAYS, ("cmdloop(%d) called\n", top)); setstackmark(&smark); for (;;) { if (pendingsigs) dotrap(); inter = 0; if (iflag == 1 && top) { inter = 1; showjobs(out2, SHOW_CHANGED); chkmail(0); flushout(&errout); nflag = 0; } n = parsecmd(inter); VXTRACE(DBG_PARSE|DBG_EVAL|DBG_CMDS,("cmdloop: "),showtree(n)); if (n == NEOF) { if (!top || numeof >= 50) break; if (nflag) break; if (!stoppedjobs()) { if (!iflag || !Iflag) break; out2str("\nUse \"exit\" to leave shell.\n"); } numeof++; } else if (n != NULL && nflag == 0) { job_warning = (job_warning == 2) ? 1 : 0; numeof = 0; evaltree(n, 0); } rststackmark(&smark); /* * Any SKIP* can occur here! SKIP(FUNC|BREAK|CONT) occur when * a dotcmd is in a loop or a function body and appropriate * built-ins occurs in file scope in the sourced file. Values * other than SKIPFILE are reset by the appropriate eval*() * that contained the dotcmd() call. */ skip = current_skipstate(); if (skip != SKIPNONE) { if (skip == SKIPFILE) stop_skipping(); break; } } popstackmark(&smark); }
void readf(FILE* fIN) { char buff[256]; NodeT *p; while(feof(fIN)==0) { fgets(buff,sizeof(buff),fIN); if(buff[0]=='e') p=createBIN(buff+2,strlen(buff)-4); if(buff[0]=='p') showtree(p,0); } }
void main() { node*root,*root1; clrscr(); gotoxy(1,25); cout<<"enter the tree"; root=new node; gettree(root,40,1); cout<<"the tree loaded"; sound(200); delay(1000); nosound(); getch(); getch(); clrscr(); showtree(root,40,10); getch(); root1=new node; createig(root,root1); clrscr(); showtree(root1,40,10); getch(); }
void showtree(node*trev,int x,int y) { gotoxy(x,y); fflush(stdin); puts(trev->a); if(trev->lt!=NULL) { gotoxy(x-1,y+1); printf("/"); gotoxy(x-2,y+2); printf("/"); showtree(trev->lt,x-3,y+3); } if(trev->rt!=NULL) { gotoxy(x+1,y+1); printf("\\"); gotoxy(x+2,y+2); printf("\\"); showtree(trev->rt,x+3,y+3); } }
void Bintree::showtree(int xnew, int ynew) { showtree(rootleaf, xnew, ynew, 0); }