Write C programs to simulate the Hierarchical directory File organization technique #include<stdio.h> #include<graphics.h> #include<string.h> struct tree_element { char name[20]; int x, y, ftype, lx, rx, nc, level; struct tree_element *link[5]; }; typedef struct tree_element node; void main() { int gd=DETECT,gm; node *root; root=NULL; create(&root,0,"root",0,639,320); clrscr(); initgraph(&gd,&gm,"c:\tc\BGI"); display(root); closegraph(); } create(node **root,int lev,char *dname,int lx,int rx,int x) { int i, gap; if(*root==NULL) { (*root)=(node *)malloc(sizeof(node)); printf("Enter name of dir/file(under %s) : ",dname); fflush(stdin); gets((*root)->name); printf("enter 1 for Dir/2 for file :"); scanf("%d",&(*root)->ftype); (*root)->level=lev; (*root)->y=50+lev*50; (*root)->x=x; (*root)->lx=lx; (*root)->rx=rx; for(i=0;i<5;i++) (*root)->li
Comments
Post a Comment