33 lines
790 B
C
33 lines
790 B
C
/** @file money.h
|
|
* Money structure header file used in the program
|
|
*/
|
|
|
|
#ifndef MONEY_H
|
|
#define MONEY_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
/**
|
|
* @struct money
|
|
* @brief Struct Holding the Monetary value in a separate form
|
|
*/
|
|
|
|
typedef struct money {
|
|
int full; ///< The Full part of the monetary value
|
|
int cents; ///< The Cents parts of the monetary value
|
|
} Money;
|
|
|
|
Money *initalizeMoney(int full, int cents);
|
|
|
|
void addMoneyToMoney(Money *dest, Money *src);
|
|
void subtractMoneyToMoney(Money *dest, Money *src);
|
|
bool checkOverflow(Money *m);
|
|
bool checkUnderflow(Money *m);
|
|
void handleOverflow(Money *m);
|
|
void handleUnderflow(Money *m);
|
|
void setMoneyValue(Money *m, int full, int cents);
|
|
char *getMoneyString(Money *m);
|
|
void destroyMoney(Money *money);
|
|
#endif |