/******************************************************* * Author: Dave Schoeffler * * This program will utilize my own binary tree library * * to accept as input unique characters from the user * * and store them in a binary tree. After that it will * * display the characters in lexiographical order. * * * * Compile with: gcc -o tree tree.c -ltree -L. * * * * Execute with: ./tree * * * *******************************************************/ #include "tree.h"//my tree library int main() { //declaration of a Tree struc that will be used to store the characters Tree *aTree; aTree = malloc(sizeof(Tree *)); char choice, junk;//variable choice will be used to store the current //character from the user printf("Enter a letter( '.' to quit): ");//user prompt for input scanf("%c",&choice); scanf("%c",&junk); while( choice != '.') { aTree = insert(aTree, choice);//this line sends the character to the //insert node function printf("Enter a letter( '.' to quit): "); scanf("%c",&choice); scanf("%c",&junk); } printf("The following values are contained in this binary tree: "); display(aTree -> root);//displays the tree values in lexigraphical order printf("\n"); return (0); }