feat: Initial commit
This commit is contained in:
55
Laboratorio 4/Esercizio 2/item.h
Normal file
55
Laboratorio 4/Esercizio 2/item.h
Normal file
@@ -0,0 +1,55 @@
|
||||
// Laboratorio 4 - Esercizio 2 - item.h
|
||||
// Matteo Schiff - s295565
|
||||
|
||||
#ifndef ITEM_H_DEFINED
|
||||
#define ITEM_H_DEFINED
|
||||
|
||||
#define CODE_LEN 5
|
||||
#define STR_LEN 50
|
||||
|
||||
typedef struct date_s {
|
||||
int day;
|
||||
int month;
|
||||
int year;
|
||||
} Date;
|
||||
|
||||
typedef struct item_s {
|
||||
char code[CODE_LEN+1];
|
||||
char name[STR_LEN+1];
|
||||
char surname[STR_LEN+1];
|
||||
Date date;
|
||||
char address[STR_LEN+1];
|
||||
char city[STR_LEN+1];
|
||||
int cap;
|
||||
} *Item;
|
||||
|
||||
typedef struct node_s *Link;
|
||||
typedef struct node_s {
|
||||
Item val;
|
||||
Link next;
|
||||
} Node;
|
||||
|
||||
typedef char* Key;
|
||||
|
||||
// Date
|
||||
|
||||
int DateGreater(Date a, Date b);
|
||||
|
||||
// Item
|
||||
|
||||
Item ItemFromString(char *str);
|
||||
Item ItemRead(FILE * fp);
|
||||
Key ItemKey(Item item);
|
||||
int ItemEq(Key x, Key y);
|
||||
void ItemPrint(FILE *fp, Item x);
|
||||
|
||||
// List
|
||||
|
||||
Link insertOrderedByDate(Item val, Link head);
|
||||
Item getItemByCode(Link head, Key key);
|
||||
void printList(FILE *fp, Link head);
|
||||
Item extractCode(Link *headp, Key key);
|
||||
Item extractDates(Link *headp, Date first, Date last);
|
||||
void freeList(Link head);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user