/*--------------------------------------------------------------------*/ /* teststackao.c */ /* Author: Bob Dondero */ /* A Stack abstract object client */ /*--------------------------------------------------------------------*/ #include "stackao.h" #include int main(void) /* Test the Stack abstract object. Return 0. */ /* For simplicity, ignore the possibility of insufficient memory. */ { Stack_init(); Stack_push(1.1); Stack_push(2.2); Stack_push(3.3); while (! Stack_isEmpty()) { printf("%g\n", Stack_top()); Stack_pop(); } Stack_free(); Stack_init(); Stack_push(4.4); Stack_push(5.5); Stack_push(6.6); while (! Stack_isEmpty()) { printf("%g\n", Stack_top()); Stack_pop(); } Stack_free(); return 0; } /* Output: 3.3 2.2 1.1 6.6 5.5 4.4 */