#include #include #include #include "word.h" #include "tree.h" #define MAXWORD 100 #define ARR_SIZE(X) (sizeof(X)/sizeof(X[0])) const char *noise[] = { "the", "and" }; int isnoise(char *word); int main(void) { char word[MAXWORD]; struct tnode *root; int line = 0; root = NULL; while (getword(word, MAXWORD) != EOF) if (isalpha(word[0]) && !isnoise(word)) root = addtree(root, word, line); else if(word[0] == '\n') ++line; tprint(root); tfree(root); return 0; } int isnoise(char *word) { size_t i; for(i = 0; i < ARR_SIZE(noise); ++i) if (!strcmp(word, noise[i])) return 1; return 0; }