/* * calc.c * * This file contains a main() that drives the differentiate() function. * It reads in a polynomial, finds the derivative, then prints it. */ #include #include #include "mono.h" #include "poly.h" #include "diff.h" int main () { poly F, /* user input polynomial */ L; /* derivative of input polynomial */ if (isatty (0)) printf ("Enter your polynomial: "); /* get the polynomial from standard input */ F = get_poly (); /* echo the polynomial */ printf ("derivative of\n"); print_poly (F); /* find and print the derivative */ printf ("\nis\n"); L = differentiate (F); print_poly (L); printf ("\n"); /* clean up and exit */ destroy_poly (&L); exit (0); }