-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpupil.h
83 lines (50 loc) · 1.58 KB
/
pupil.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
83
#pragma once
#include <stdlib.h>
#include <stdbool.h>
typedef enum { female, male } Gender;
typedef char* string;
typedef enum month { Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec } month;
char to_lower_char(char);
time_t parse_date(string time_str);
struct Pupil {
char first_name[64];
char* last_name[64];
Gender gender;
time_t date_of_birth;
char adress[256];
struct Pupil* prev;
struct Pupil* next;
};
typedef struct Pupil Pupil;
void InitElement(Pupil* p);
void InitName(Pupil* p, string first_name, string last_name);
void InitGender(Pupil* p, Gender gender);
void InitDate(Pupil* p, time_t date);
void InitAdress(Pupil* p, string adress);
Pupil* CopyElement(Pupil* p);
void FillPupilInfo(Pupil* p);
void PrintPupilInfo(Pupil p);
void InitPupilInfo(Pupil* p, char* first_name, char* last_name, Gender gender, time_t date_of_birth, char* adress);
time_t date_to_unix(int day, month month, int year);
void print_date(time_t unix);
typedef struct {
Pupil* First;
Pupil* Last;
} List;
Pupil* GetElement(List* L, size_t index);
void InitList(List* L);
List CopyList(List* L);
void FillListWithPupils(List* L, size_t size);
bool PrintList(List* L);
void Append(List* L, Pupil* e);
void Prepend(List* L, Pupil* e);
void Insert(List* L, size_t index, Pupil* e);
int Size(List* L);
void Swap(size_t index_1, size_t index_2, List* l);
void DeleteElem(List* L, size_t index);
void Free(List* L, Pupil* e);
void FreeList(List* L);
void Sort(List* L);
List Search(List* L, string last_name);
bool LoadFile(List* l, char* path);
bool WriteToFile(List* l, char* path);