/* This is the main program that appeared in the Project 2 * handout. Feel free to use it as is, modify it in any * way, or write your own main from scratch. */ #include #include #include "p2.h" void main(int argc, char *argv[]) { whamo_type whamo; comparator comp; FILE * fp; /* Check number and composition of command line arguments; exit if wrong */ CheckCmdLineArgs(argc, argv); /* Determine comparator to use */ comp = DetermineComparator(argv[1], argv[2]); /* Open input data file; exit if can't open it */ fp = OpenInputFile(argv[3]); /* Make a new Whamo, and read the file into it */ whamo = makeWhamo(comp); ReadFileIntoWhamo(fp, whamo); /* Print info from the Whamo */ fprintf(stdout, "\nFirst value is "); printdata(stdout, getfirstWhamo(whamo)); putc('\n', stdout); fprintf(stdout, "Last value is "); printdata(stdout, getlastWhamo(whamo)); putc('\n', stdout); printWhamo(stdout, whamo, printdata); putc('\n', stdout); /* Do the transforms */ transformWhamo(whamo, doubleint); transformWhamo(whamo, sqrtreal); transformWhamo(whamo, a2z); printWhamo(stdout, whamo, printdata); }