/*--------------------------------------------------------------------*/ /* teststack.c (Version 3) */ /* Author: Bob Dondero */ /*--------------------------------------------------------------------*/ #include "stack.h" #include int main(void) /* Test the Stack ADT. Return 0. */ { Stack_T oStack1; Stack_T oStack2; oStack1 = Stack_new(); Stack_push(oStack1, 1.1); Stack_push(oStack1, 2.2); Stack_push(oStack1, 3.3); while (! Stack_isEmpty(oStack1)) { printf("%g\n", Stack_top(oStack1)); Stack_pop(oStack1); } Stack_free(oStack1); oStack2 = Stack_new(); Stack_push(oStack2, 4.4); Stack_push(oStack2, 5.5); Stack_push(oStack2, 6.6); while (! Stack_isEmpty(oStack2)) { printf("%g\n", Stack_top(oStack2)); Stack_pop(oStack2); } Stack_free(oStack2); return 0; } /* Output: 3.3 2.2 1.1 6.6 5.5 4.4 */