-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.h
136 lines (121 loc) · 3.08 KB
/
header.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#define MAX_NAME_LENGTH 20
#define MAX_SUBJECT_LENGTH 20
typedef struct
{
char *name;
float grade;
} Subject;
typedef struct
{
char *name;
Subject subject;
} Teacher;
typedef struct
{
Teacher **teachers;
int currentSize;
int maxSize;
} TeachersList;
typedef struct
{
char *name;
int subjectCount;
Subject *subjects;
} Student;
typedef struct
{
Student **students;
int currentSize;
int maxSize;
} StudentsList;
/**
* @brief Finds the index of the student in the students list if they
* exist.
*
* @param list
* @param studentName
* @return int Returns the (first) index of the student found by
* studentName in the StudentsList passed as argument. Otherwise,
* returns -1 if not found.
*/
int studentExists(StudentsList *list, char *studentName);
/**
* @brief Finds the index of the subject within the subjects array
* inside the student if they exist.
*
* @param student
* @param subject
* @return int int Returns the (first) index of the subject found by
* subjectName for the Student passed as argument. Otherwise,
* returns -1 if not found.
*/
int subjectExistsForStudent(Student *student, char *subject);
/**
* @brief Adds a new subject with the subjectName, and grade passed in as
* argument for the student identified by studentName.
*
* @param list
* @param studentName
* @param subjectName
* @param gradeInput
*/
void addSubject(StudentsList *list, char *studentName, char *subjectName, float gradeInput);
/**
* @brief Adds a new student to the StudentsList passed in as argument.
*
* @param studentsList
* @param studentName
* @return int
*/
int addStudent(StudentsList *studentsList, char *studentName);
/**
* @brief Adds a new teacher to the TeachersList passed in as argument.
*
* @param list
* @param teacherName
* @param subjectName
*/
void addTeacher(TeachersList *list, char *teacherName, char *subjectName);
/**
* @brief
*
* @param list
* @param teacher
* @return int Returns the (first) index of the teacher found by
* their name in the TeachersList passed as argument. Otherwise,
* returns -1 if not found.
*/
int teacherExists(TeachersList *list, char *teacher);
/**
* @brief Determines if a teacher is already registered as teaching the
* subject passed in as argument.
*
* @param list
* @param subject
* @return int
*/
int teacherExistsForSubject(TeachersList *list, char *subject);
/**
* @brief Displays all the subjects and their corresponding grades
* for the Student passed in as argument.
*
* @param student
*/
void displaySubject(Student *student);
/**
* @brief Asks user if they wish the StudentsList and TeachersList
* passed in as argument to their corresponding csv files.
*
* @param studentsList
* @param teachersList
* @return int Returns 1 if able to save successfully, otherwise -1.
*/
int save(StudentsList *studentsList, TeachersList *teachersList);
/**
* @brief Reads data from the teachers' CSV file into the TeachersList
* passed in as argument.
*
* @param list
* @return int Returns 1 if able to read file data successfuly, otherwise -1.
*/
int readTeachers(TeachersList *list);