45 lines
828 B
C
45 lines
828 B
C
|
#ifndef WWS_H_
|
||
|
#define WWS_H_
|
||
|
|
||
|
#include "util.h"
|
||
|
|
||
|
#define ARRSIZE 4096
|
||
|
#define EXITVAL 15326
|
||
|
|
||
|
typedef struct Product Product;
|
||
|
typedef struct Customer Customer;
|
||
|
|
||
|
struct Product {
|
||
|
int id;
|
||
|
char* name;
|
||
|
double price;
|
||
|
int amount;
|
||
|
};
|
||
|
|
||
|
struct Customer {
|
||
|
char* name;
|
||
|
int id;
|
||
|
// NOTE: Always NULL-initialize this!!
|
||
|
Product* products[ARRSIZE];
|
||
|
};
|
||
|
|
||
|
// Implementation details
|
||
|
int read_id();
|
||
|
char* read_name();
|
||
|
double read_price();
|
||
|
int read_amount();
|
||
|
int find_first_free_index(Customer customer);
|
||
|
int find_product(Customer customer, int id); // Returns index of product
|
||
|
int find_customer(int id); // Returns index in the customers array
|
||
|
|
||
|
// Top-Level functions
|
||
|
int add_product();
|
||
|
int print_product();
|
||
|
int add_customer();
|
||
|
int print_customer();
|
||
|
int menu();
|
||
|
|
||
|
extern Customer customers[ARRSIZE];
|
||
|
|
||
|
#endif // WWS_H_
|