-
Notifications
You must be signed in to change notification settings - Fork 0
/
gjc.h
executable file
·82 lines (69 loc) · 1.86 KB
/
gjc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/****************************************************************************
* COSC2541 - Programming Techniques
* Semester 2 2011 Assignment #2
* Full Name : Dang Nguyen Hoang Gia
* Student Number : s3269900
* Start up code provided by Christopher Hoobin, Xiaodong Li and Quang Tran
****************************************************************************/
#ifndef GJC_H
#define GJC_H
/* System-wide header files. */
#include <stdio.h>
#include <stdlib.h>
/* System-wide constants. */
#define ID_LEN 5
#define MIN_NAME_LEN 1
#define MAX_NAME_LEN 25
#define MIN_DESC_LEN 1
#define MAX_DESC_LEN 250
#define NUM_PRICES 3
#define HOT 'H'
#define COLD 'C'
#define SUCCESS 1
#define FAILURE 0
/*
my define constant here
*/
/* This is used to compensate for the extra character spaces taken up by
the '\n' and '\0' when user is asked for input through fgets(). */
#define EXTRA_SPACES 2
/* Specifies the maximum input length a user can enter for the options
menu. */
#define MAX_OPTION_INPUT 1
#define MAX_LINE_SIZE 255
#define MAX_TOKENS_MENU 5
#define MAX_TOKENS_SUBMENU 8
#define TRUE 1
#define FALSE 0
typedef struct category *CategoryTypePtr;
typedef struct item *ItemTypePtr;
/* Structure definitions. */
typedef struct price
{
unsigned dollars;
unsigned cents;
} PriceType;
typedef struct item
{
char itemID[ID_LEN + 1];
char itemName[MAX_NAME_LEN + 1];
PriceType prices[NUM_PRICES];
char itemDescription[MAX_DESC_LEN + 1];
ItemTypePtr nextItem;
} ItemType;
typedef struct category
{
char categoryID[ID_LEN + 1];
char categoryName[MAX_NAME_LEN + 1];
char categoryType; /* (H)ot or (C)old. */
char categoryDescription[MAX_DESC_LEN + 1];
CategoryTypePtr nextCategory;
ItemTypePtr headItem;
unsigned numItems;
} CategoryType;
typedef struct gjc
{
CategoryTypePtr headCategory;
unsigned numCategories;
} GJCType;
#endif