aboutsummaryrefslogtreecommitdiff
path: root/6.4/main.c
diff options
context:
space:
mode:
Diffstat (limited to '6.4/main.c')
-rw-r--r--6.4/main.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/6.4/main.c b/6.4/main.c
new file mode 100644
index 0000000..c5a2255
--- /dev/null
+++ b/6.4/main.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <ctype.h>
+#include "word.h"
+#include "tree.h"
+
+#define MAXWORD 100
+#define NDISTINCTTREE 1000
+
+struct tnode *tlist[NDISTINCTTREE];
+
+int main(void)
+{
+ char word[MAXWORD];
+ struct tnode *root;
+ int nt;
+
+ root = NULL;
+ while (getword(word, MAXWORD) != EOF)
+ if (isalpha(word[0]))
+ root = addtree(root, word);
+
+ nt = tlstore(root, tlist, NDISTINCTTREE);
+ tlsort(tlist, nt);
+ printtl(tlist, nt);
+ tfree(root);
+
+ return 0;
+}