-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
126 lines (93 loc) · 2.63 KB
/
main.c
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
//THIS PROGRAM IS A STUDENTS DATABASE
//I HAD FINSHED THIS PRIGRAM AS A PROJECT IN AMIT C PROGRAMMING COURSE
//THIS PROJRAM CONTAIN THE BASIC FUNCTION FOR ANY SOFTWARE DATABASE THAT CAN READ and INSERT ,DELETE ,SEARCH BY ID ,
//PRINT ALL DATABASE INFO AND READ INFORMATIONS FROM A SPACEFIC STUDENT
//AUTHOR : KHALED MOSTAFA
//IN 28/12/25018
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include "HELPERFUNCS.c"
#include "SDB.c"
#include "LINKEDLIST.c"
int main()
{
char input[10];
uint8 choise = 0, year[1], subjects[3], grades[3], count[10], list[10];
int checker;
do
{
choise = menu();
switch (choise)
{
uint8 id;
case 1:
switch (SDB_isFull())
{
case 1:
puts("SDB Is Full");
break;
case 0:
puts("SDB Is Not Full");
break;
}
break;
case 2:
printf("The Used Size is %d.\n", SDB_GetUsedSize());
break;
case 3:
ask_for_detail();
break;
case 4:
do
{
puts("Enter The Student ID to Delete.");
scanf("%s", input);
} while ((id = Int_checker(input)) == tester);
if (SDB_IsIdExist(id) == 1)
{
SDB_DeleteEntry(id);
puts("Deleteing Succesfully.");
}
else
{
puts("The Student ID is Not in The Database.");
}
break;
case 5:
do
{
puts("Enter The Student ID.");
scanf("%s", input);
} while ((id = Int_checker(input)) == tester);
checker = SDB_ReadEntry(id, year, subjects, grades);
//printf("%d\n", checker);
break;
case 6:
SDB_GetidList(count, list);
break;
case 7:
do
{
puts("Enter The Student ID to Found.");
scanf("%s", input);
} while ((id = Int_checker(input)) == tester);
switch (SDB_IsIdExist(id))
{
case 1:
printf("The Student ID is in The Database.\n");
break;
case 0:
printf("The Student ID is Not in The Database.\n");
break;
}
break;
case 8:
print();
break;
}
} while (choise != 9);
menuIndentation(7);
printf("Thanks AMIT's C Project Tester.\n");
return 0;
}