/* * Simple "US money" type -- declaration of type and some functions. */ /* * the next two lines avoid problems if file is inadvertently #include'd * twice. good style even though in this simple examples the problem seems * unlikely. */ #ifndef SIMPLE_US_MONEY_H #define SIMPLE_US_MONEY_H #include #include typedef struct { bool is_negative; unsigned long dollars; unsigned short cents; } us_money_t; /* print in some nice format ($dollar.cents, with - if needed) */ void print_money(FILE * f, us_money_t); /* input money in form dollars.cents */ bool input_money(FILE * f, us_money_t *m); us_money_t add_money(us_money_t m1, us_money_t m2); us_money_t subtract_money(us_money_t m1, us_money_t m2); us_money_t multiply_money(us_money_t m1, double d); #endif /* end of #ifndef SIMPLE_US_MONEY_H */