blob: c5a225569880e99c58f8f4dc076e84c4d054de0a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
}
|