Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tp_B+Tree
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
daniel.rodrigue1
tp_B+Tree
Commits
0f7f7730
Commit
0f7f7730
authored
2 years ago
by
Daniel Rodriguez
Browse files
Options
Downloads
Patches
Plain Diff
fin du projet
parent
3bac9301
Branches
main
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
b-tree.c
+21
-8
21 additions, 8 deletions
b-tree.c
b-tree.h
+6
-5
6 additions, 5 deletions
b-tree.h
main.c
+94
-49
94 additions, 49 deletions
main.c
record.c
+12
-65
12 additions, 65 deletions
record.c
record.h
+4
-9
4 additions, 9 deletions
record.h
with
137 additions
and
136 deletions
b-tree.c
+
21
−
8
View file @
0f7f7730
...
@@ -19,7 +19,7 @@ b_tree create_node(){
...
@@ -19,7 +19,7 @@ b_tree create_node(){
}
}
for
(
int
i
=
0
;
i
<
M
;
i
++
){
for
(
int
i
=
0
;
i
<
M
;
i
++
){
root
->
keys
[
i
]
=
0
;
root
->
keys
[
i
]
=
0
;
root
->
data
[
i
]
=
create_P_and_val
(
NULL
,
0
)
;
root
->
data
[
i
]
=
NULL
;
}
}
root
->
count
=
0
;
root
->
count
=
0
;
return
root
;
return
root
;
...
@@ -49,6 +49,19 @@ void print_tree(b_tree tree, int depth){
...
@@ -49,6 +49,19 @@ void print_tree(b_tree tree, int depth){
}
}
}
}
void
list
(
b_tree
node
){
while
(
!
is_leaf
(
node
))
{
node
=
node
->
children
[
0
];
}
while
(
node
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
node
->
count
;
i
++
){
print_record
(
*
node
->
data
[
i
]);
printf
(
"
\n
"
);
}
node
=
node
->
children
[
M
];
}
}
void
print_p_list
(
void
**
lst
,
int
start
,
int
end
,
char
*
stater
,
char
*
separator
,
char
*
ender
){
void
print_p_list
(
void
**
lst
,
int
start
,
int
end
,
char
*
stater
,
char
*
separator
,
char
*
ender
){
printf
(
"%s"
,
stater
);
printf
(
"%s"
,
stater
);
for
(
int
i
=
start
;
i
<
end
-
1
;
i
++
){
for
(
int
i
=
start
;
i
<
end
-
1
;
i
++
){
...
@@ -104,7 +117,7 @@ P_and_val split(b_tree node){
...
@@ -104,7 +117,7 @@ P_and_val split(b_tree node){
newNode
->
keys
[
i
-
M
/
2
]
=
node
->
keys
[
i
];
newNode
->
keys
[
i
-
M
/
2
]
=
node
->
keys
[
i
];
newNode
->
data
[
i
-
M
/
2
]
=
node
->
data
[
i
];
newNode
->
data
[
i
-
M
/
2
]
=
node
->
data
[
i
];
node
->
keys
[
i
]
=
0
;
node
->
keys
[
i
]
=
0
;
node
->
data
[
i
]
=
create_P_and_val
(
NULL
,
0
)
;
node
->
data
[
i
]
=
NULL
;
}
}
// resize two nodes
// resize two nodes
node
->
count
=
M
/
2
;
node
->
count
=
M
/
2
;
...
@@ -130,7 +143,7 @@ P_and_val split(b_tree node){
...
@@ -130,7 +143,7 @@ P_and_val split(b_tree node){
return
create_P_and_val
(
newNode
,
pivot
);
return
create_P_and_val
(
newNode
,
pivot
);
}
}
P_and_val
insert_into_node
(
b_tree
node
,
uint64_t
key
,
P_and_val
data
){
P_and_val
insert_into_node
(
b_tree
node
,
uint64_t
key
,
record_t
*
data
){
int
index
=
find_insertion_index
(
node
->
keys
,
node
->
count
,
key
);
int
index
=
find_insertion_index
(
node
->
keys
,
node
->
count
,
key
);
// insert key and data into list their respective list
// insert key and data into list their respective list
...
@@ -150,7 +163,7 @@ P_and_val insert_into_node(b_tree node, uint64_t key, P_and_val data){
...
@@ -150,7 +163,7 @@ P_and_val insert_into_node(b_tree node, uint64_t key, P_and_val data){
}
}
}
}
P_and_val
insert
(
b_tree
tree
,
uint64_t
key
,
P_and_val
data
){
P_and_val
insert
(
b_tree
tree
,
uint64_t
key
,
record_t
*
data
){
P_and_val
retenue
=
create_P_and_val
(
NULL
,
0
);
P_and_val
retenue
=
create_P_and_val
(
NULL
,
0
);
if
(
is_leaf
(
tree
)){
if
(
is_leaf
(
tree
)){
retenue
=
insert_into_node
(
tree
,
key
,
data
);
retenue
=
insert_into_node
(
tree
,
key
,
data
);
...
@@ -170,7 +183,7 @@ P_and_val insert(b_tree tree, uint64_t key, P_and_val data){
...
@@ -170,7 +183,7 @@ P_and_val insert(b_tree tree, uint64_t key, P_and_val data){
return
retenue
;
return
retenue
;
}
}
b_tree
insert_into_tree
(
b_tree
tree
,
uint64_t
key
,
P_and_val
data
){
b_tree
insert_into_tree
(
b_tree
tree
,
uint64_t
key
,
record_t
*
data
){
P_and_val
retenue
=
insert
(
tree
,
key
,
data
);
P_and_val
retenue
=
insert
(
tree
,
key
,
data
);
if
(
retenue
.
pointer
!=
NULL
){
if
(
retenue
.
pointer
!=
NULL
){
b_tree
newRoot
=
create_node
();
b_tree
newRoot
=
create_node
();
...
@@ -183,7 +196,7 @@ b_tree insert_into_tree(b_tree tree, uint64_t key, P_and_val data){
...
@@ -183,7 +196,7 @@ b_tree insert_into_tree(b_tree tree, uint64_t key, P_and_val data){
return
tree
;
return
tree
;
}
}
P_and_val
search
(
b_tree
tree
,
uint64_t
key
){
record_t
*
search
(
b_tree
tree
,
uint64_t
key
){
int
index
=
find_insertion_index
(
tree
->
keys
,
tree
->
count
,
key
);
int
index
=
find_insertion_index
(
tree
->
keys
,
tree
->
count
,
key
);
if
(
!
is_leaf
(
tree
)){
if
(
!
is_leaf
(
tree
)){
return
search
(
tree
->
children
[
index
],
key
);
return
search
(
tree
->
children
[
index
],
key
);
...
@@ -194,7 +207,7 @@ P_and_val search(b_tree tree, uint64_t key){
...
@@ -194,7 +207,7 @@ P_and_val search(b_tree tree, uint64_t key){
return
tree
->
data
[
index
-
1
];
return
tree
->
data
[
index
-
1
];
}
}
else
{
else
{
return
create_P_and_val
(
NULL
,
0
)
;
return
NULL
;
}
}
}
}
}
}
...
@@ -208,7 +221,7 @@ void free_b(b_tree node){
...
@@ -208,7 +221,7 @@ void free_b(b_tree node){
}
}
}
}
for
(
int
i
=
0
;
i
<
node
->
count
;
i
++
){
for
(
int
i
=
0
;
i
<
node
->
count
;
i
++
){
record_t
*
data
=
node
->
data
[
i
]
.
pointer
;
record_t
*
data
=
node
->
data
[
i
];
if
(
data
!=
NULL
){
if
(
data
!=
NULL
){
free
(
data
);
free
(
data
);
}
}
...
...
This diff is collapsed.
Click to expand it.
b-tree.h
+
6
−
5
View file @
0f7f7730
...
@@ -15,7 +15,7 @@ typedef struct _P_and_val{
...
@@ -15,7 +15,7 @@ typedef struct _P_and_val{
typedef
struct
_b_node
{
typedef
struct
_b_node
{
struct
_b_node
*
children
[
M
+
1
];
struct
_b_node
*
children
[
M
+
1
];
uint64_t
keys
[
M
];
uint64_t
keys
[
M
];
P_and_val
data
[
M
];
record_t
*
data
[
M
];
int
count
;
int
count
;
}
b_node
;
}
b_node
;
...
@@ -24,14 +24,15 @@ typedef b_node* b_tree;
...
@@ -24,14 +24,15 @@ typedef b_node* b_tree;
P_and_val
create_P_and_val
(
void
*
pointer
,
uint64_t
val
);
P_and_val
create_P_and_val
(
void
*
pointer
,
uint64_t
val
);
b_tree
create_node
();
b_tree
create_node
();
bool
is_leaf
(
b_tree
node
);
bool
is_leaf
(
b_tree
node
);
void
list
(
b_tree
node
);
void
print_node
(
b_tree
node
);
void
print_node
(
b_tree
node
);
void
print_tree
(
b_tree
tree
,
int
depth
);
void
print_tree
(
b_tree
tree
,
int
depth
);
int
find_insertion_index
(
uint64_t
*
lst
,
int
size
,
uint64_t
val
);
int
find_insertion_index
(
uint64_t
*
lst
,
int
size
,
uint64_t
val
);
P_and_val
split
(
b_tree
node
);
P_and_val
split
(
b_tree
node
);
P_and_val
insert_into_node
(
b_tree
node
,
uint64_t
key
,
P_and_val
data
);
P_and_val
insert_into_node
(
b_tree
node
,
uint64_t
key
,
record_t
*
data
);
P_and_val
insert
(
b_tree
tree
,
uint64_t
key
,
P_and_val
data
);
P_and_val
insert
(
b_tree
tree
,
uint64_t
key
,
record_t
*
data
);
b_tree
insert_into_tree
(
b_tree
tree
,
uint64_t
key
,
P_and_val
data
);
b_tree
insert_into_tree
(
b_tree
tree
,
uint64_t
key
,
record_t
*
data
);
P_and_val
search
(
b_tree
tree
,
uint64_t
key
);
record_t
*
search
(
b_tree
tree
,
uint64_t
key
);
void
free_b
(
b_tree
node
);
void
free_b
(
b_tree
node
);
#endif
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
main.c
+
94
−
49
View file @
0f7f7730
#include
<openssl/sha.h>
#include
<openssl/sha.h>
#include
<stdbool.h>
#include
<stdint.h>
#include
<stdint.h>
#include
<stdio.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<stdlib.h>
...
@@ -38,7 +39,7 @@ void write_database_to_disk(char* fileName, b_tree node){
...
@@ -38,7 +39,7 @@ void write_database_to_disk(char* fileName, b_tree node){
}
}
while
(
node
!=
NULL
)
{
while
(
node
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
node
->
count
;
i
++
){
for
(
int
i
=
0
;
i
<
node
->
count
;
i
++
){
record_t
*
truc
=
node
->
data
[
i
]
.
pointer
;
record_t
*
truc
=
node
->
data
[
i
];
//print_record(*truc);
//print_record(*truc);
fwrite
(
truc
,
sizeof
(
record_t
),
1
,
f
);
fwrite
(
truc
,
sizeof
(
record_t
),
1
,
f
);
}
}
...
@@ -52,68 +53,112 @@ record_t* read_data_from_disk(char* fileName, int index){
...
@@ -52,68 +53,112 @@ record_t* read_data_from_disk(char* fileName, int index){
FILE
*
f
;
FILE
*
f
;
f
=
fopen
(
fileName
,
"rb"
);
f
=
fopen
(
fileName
,
"rb"
);
if
(
f
==
NULL
){
if
(
f
==
NULL
){
printf
(
"Failed to open file
\n
"
);
assert
(
false
);
assert
(
false
);
}
}
fseek
(
f
,
0
,
SEEK_END
);
unsigned
long
file_length
=
ftell
(
f
);
//printf("%lu, %lu\n",file_length, index*sizeof(record_t));
if
(
file_length
<=
index
*
sizeof
(
record_t
)){
//printf("exit: %lu\n",index*sizeof(record_t));
free
(
data
);
return
NULL
;
}
fseek
(
f
,
index
*
sizeof
(
record_t
),
SEEK_SET
);
fseek
(
f
,
index
*
sizeof
(
record_t
),
SEEK_SET
);
fread
(
data
,
sizeof
(
record_t
),
1
,
f
);
fread
(
data
,
sizeof
(
record_t
),
1
,
f
);
//printf("%p\n", data);
fclose
(
f
);
fclose
(
f
);
return
data
;
return
data
;
}
}
b_tree
import_b_tree_from_save
(
b_tree
node
,
char
*
fileName
){
FILE
*
f
;
f
=
fopen
(
fileName
,
"rb"
);
if
(
f
==
NULL
){
printf
(
"Failed to open file
\n
"
);
assert
(
false
);
}
int
i
=
0
;
while
(
true
)
{
record_t
*
data
=
read_data_from_disk
(
fileName
,
i
);
if
(
data
==
NULL
){
break
;
}
insert_into_tree
(
node
,
record_hash
(
data
),
data
);
i
+=
1
;
}
return
node
;
}
int
main
(){
int
main
(){
record_t
*
r0
=
create_record
(
2000
,
0
,
0
,
"0"
,
"daniel"
,
"rodriguez"
);
b_tree
node
=
create_node
();
record_t
*
r1
=
create_record
(
2001
,
1
,
1
,
"1"
,
"pierre"
,
"roden"
);
char
saveName
[
30
];
record_t
*
r2
=
create_record
(
2002
,
2
,
2
,
"2"
,
"gagaetan"
,
"siffert"
);
bool
isSaving
=
false
;
record_t
*
r3
=
create_record
(
2003
,
3
,
3
,
"3"
,
"lucas"
,
"tschaler"
);
char
choice
;
record_t
*
r4
=
create_record
(
2004
,
4
,
4
,
"4"
,
"antoine"
,
"gilles"
);
record_t
*
r5
=
create_record
(
2005
,
5
,
5
,
"5"
,
"william"
,
"ho"
);
//record_t* a = record_prompt();
printf
(
"Bienvenue dans votre annuaire
\n
"
);
//record_t* b = record_prompt();
printf
(
"Voulez vous importer l'annuaire depuis un fichier local? [y/n]
\n
"
);
scanf
(
"%c"
,
&
choice
);
flush_input
();
b_tree
node
=
create_node
();
if
(
choice
==
'y'
){
printf
(
"Entrez le nom du fichier du fichier à importer(max 29 char)
\n
"
);
node
=
insert_into_tree
(
node
,
record_hash
(
r0
),
create_P_and_val
(
r0
,
0
));
scanf
(
" %29s"
,
saveName
);
node
=
insert_into_tree
(
node
,
record_hash
(
r1
),
create_P_and_val
(
r1
,
0
));
flush_input
();
node
=
insert_into_tree
(
node
,
record_hash
(
r2
),
create_P_and_val
(
r2
,
0
));
node
=
import_b_tree_from_save
(
node
,
saveName
);
node
=
insert_into_tree
(
node
,
record_hash
(
r3
),
create_P_and_val
(
r3
,
0
));
}
node
=
insert_into_tree
(
node
,
record_hash
(
r4
),
create_P_and_val
(
r4
,
0
));
node
=
insert_into_tree
(
node
,
record_hash
(
r5
),
create_P_and_val
(
r5
,
0
));
while
(
true
){
print_tree
(
node
,
0
);
printf
(
"
\n
Voulez vous ajouter(a), rechercher(r), quitter(q), lister(l)?
\n
"
);
write_database_to_disk
(
"test.dat"
,
node
);
scanf
(
"%c"
,
&
choice
);
flush_input
();
record_t
*
s0
=
search
(
node
,
record_hash
(
r0
)).
pointer
;
//daniel
while
(
choice
!=
'a'
&&
choice
!=
'r'
&&
choice
!=
'q'
&&
choice
!=
'l'
){
if
(
s0
==
NULL
){
printf
(
"Cette commande n'est pas valide
\n
"
);
printf
(
"
\n
"
);
printf
(
"Voulez vous ajouter(a), rechercher(r), quitter(q) ?
\n
"
);
printf
(
"could not find
\n
"
);
scanf
(
"%c"
,
&
choice
);
flush_input
();
}
if
(
choice
==
'a'
){
record_t
*
r
=
record_prompt
();
node
=
insert_into_tree
(
node
,
record_hash
(
r
),
r
);
printf
(
"Cette entrée à été ajoutée à l'annuaire
\n
"
);
}
if
(
choice
==
'r'
){
printf
(
"Indiquer le numéro de téléphone de la personne que vous cherchez(max 9 char)
\n
"
);
char
tel
[
10
];
scanf
(
" %9s"
,
tel
);
flush_input
();
record_t
*
r
=
search
(
node
,
hash
(
tel
));
if
(
r
==
NULL
){
printf
(
"Ce numéro n'est pas dans l'annuaire
\n
"
);
}
else
{
printf
(
"
\n
"
);
print_record
(
*
r
);
}
}
if
(
choice
==
'q'
){
printf
(
"Avant de quitter vouler vous sauvegarder l'annuaire? [y/n]
\n
"
);
scanf
(
"%c"
,
&
choice
);
flush_input
();
if
(
choice
==
'y'
){
isSaving
=
true
;
printf
(
"Entrez le nom du fichier de sauvegarde à créer(max 29 char)
\n
"
);
scanf
(
" %29s"
,
saveName
);
flush_input
();
}
break
;
}
if
(
choice
==
'l'
){
list
(
node
);
}
}
}
else
{
if
(
isSaving
)
{
p
ri
nt_record
(
*
s0
);
w
ri
te_database_to_disk
(
saveName
,
node
);
}
}
printf
(
"
\n
"
);
record_t
*
s1
=
search
(
node
,
record_hash
(
r2
)).
pointer
;
//gaetan
print_record
(
*
s1
);
printf
(
"
\n
"
);
record_t
*
s2
=
search
(
node
,
record_hash
(
r4
)).
pointer
;
//antoine
print_record
(
*
s2
);
/*
record_t* test = read_data_from_disk("test.dat", 0);
print_record(*test);
free(test);
printf("\n");
record_t* test1 = read_data_from_disk("test.dat", 1);
print_record(*test1);
free(test1);
free(r0);
free(r1);
free(r2);
free(r3);
free(r4);
free(r5);
*/
free_b
(
node
);
free_b
(
node
);
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
record.c
+
12
−
65
View file @
0f7f7730
...
@@ -29,95 +29,42 @@ record_t* create_record(uint16_t year, uint8_t month, uint8_t day, char phone[10
...
@@ -29,95 +29,42 @@ record_t* create_record(uint16_t year, uint8_t month, uint8_t day, char phone[10
}
}
void
print_record
(
record_t
record
){
void
print_record
(
record_t
record
){
printf
(
"
first name
: %s
\n
"
,
record
.
forename
);
printf
(
"
\n
prénom
: %s
\n
"
,
record
.
forename
);
printf
(
"
last nam
e: %s
\n
"
,
record
.
surname
);
printf
(
"
nom de famill
e: %s
\n
"
,
record
.
surname
);
printf
(
"
phone number
: %s
\n
"
,
record
.
phone
);
printf
(
"
numéro de teléphone
: %s
\n
"
,
record
.
phone
);
printf
(
"
birth dat
e: %hu-%hhu-%hhu
\n
"
,
record
.
birth_date
.
year
,
record
.
birth_date
.
month
,
record
.
birth_date
.
day
);
printf
(
"
date de naissanc
e: %hu-%hhu-%hhu
\n
"
,
record
.
birth_date
.
year
,
record
.
birth_date
.
month
,
record
.
birth_date
.
day
);
}
}
record_t
*
record_prompt
(){
record_t
*
record_prompt
(){
printf
(
"
what is your first name ?
\n
"
);
printf
(
"
\n
entrez le prénom
\n
"
);
char
first_name
[
20
];
char
first_name
[
20
];
scanf
(
" %19s"
,
first_name
);
scanf
(
" %19s"
,
first_name
);
flush_input
();
flush_input
();
printf
(
"
what is your last name ?
\n
"
);
printf
(
"
entrez le nom de famille
\n
"
);
char
last_name
[
20
];
char
last_name
[
20
];
scanf
(
" %19s"
,
last_name
);
scanf
(
" %19s"
,
last_name
);
flush_input
();
flush_input
();
printf
(
"
what is your phone number ?
\n
"
);
printf
(
"
entrez le numéro de teléphone
\n
"
);
char
phone
[
10
];
char
phone
[
10
];
scanf
(
" %9s"
,
phone
);
scanf
(
" %9s"
,
phone
);
flush_input
();
flush_input
();
printf
(
"
what is your birth year ? (input as number)
\n
"
);
printf
(
"
entrez l'année de naissance
\n
"
);
uint16_t
year
;
uint16_t
year
;
scanf
(
"%hu"
,
&
year
);
scanf
(
"%hu"
,
&
year
);
flush_input
();
flush_input
();
printf
(
"
what is your birth month ? (input as number
)
\n
"
);
printf
(
"
entrez le mois de naissance (en chiffres
)
\n
"
);
uint8_t
month
;
uint8_t
month
;
scanf
(
"%hhu"
,
&
month
);
scanf
(
"%hhu"
,
&
month
);
flush_input
();
flush_input
();
printf
(
"
what is your birth day ? (input as number
)
\n
"
);
printf
(
"
entrez le jour de naissance (en chiffres
)
\n
"
);
uint8_t
day
;
uint8_t
day
;
scanf
(
"%hhu"
,
&
day
);
scanf
(
"%hhu"
,
&
day
);
flush_input
();
flush_input
();
printf
(
"
\n
"
);
return
create_record
(
year
,
month
,
day
,
phone
,
first_name
,
last_name
);
return
create_record
(
year
,
month
,
day
,
phone
,
first_name
,
last_name
);
}
}
\ No newline at end of file
/*
void handle_bounds(database_t* d, int index){
if(index < 0 || index >= d->count){
assert(0);
}
}
database_t* create_database(){
database_t* d = malloc(sizeof(database_t));
d->size = 4;
d->count = 0;
d->data = malloc(d->size * sizeof(record_t));
return d;
}
void database_add(database_t* d, record_t* record){
if(d->count >= d->size){
d->size *= 2;
d->data = realloc(d->data, d->size * sizeof(record_t));
}
d->data[d->count] = *record;
d->count += 1;
}
void database_remove(database_t* v, int index){
handle_bounds(v, index);
for(int i = index; i < v->count-1; i++){
v->data[i] = v->data[i+1];
}
v->count -= 1;
if(v->count < 0){
assert(0);
}
if(v->count < (v->size/4)){
v->size /= 2;
v->data = realloc(v->data, v->size * sizeof(record_t));
}
}
void database_print(database_t* d){
for(int i = 0; i < d->count; i++){
print_record(d->data[i]);
printf("\n");
}
}
void database_free(database_t* d){
free(d->data);
free(d);
}
*/
\ No newline at end of file
This diff is collapsed.
Click to expand it.
record.h
+
4
−
9
View file @
0f7f7730
...
@@ -9,9 +9,9 @@ typedef struct _date{
...
@@ -9,9 +9,9 @@ typedef struct _date{
}
date_t
;
}
date_t
;
typedef
struct
_record
{
typedef
struct
_record
{
char
phone
[
1
1
];
char
phone
[
1
0
];
char
forename
[
2
1
];
char
forename
[
2
0
];
char
surname
[
2
1
];
char
surname
[
2
0
];
date_t
birth_date
;
date_t
birth_date
;
}
record_t
;
}
record_t
;
...
@@ -21,15 +21,10 @@ typedef struct _database{
...
@@ -21,15 +21,10 @@ typedef struct _database{
int
count
;
int
count
;
}
database_t
;
}
database_t
;
void
flush_input
();
date_t
create_date
(
uint16_t
year
,
uint8_t
month
,
uint8_t
day
);
date_t
create_date
(
uint16_t
year
,
uint8_t
month
,
uint8_t
day
);
record_t
*
create_record
(
uint16_t
year
,
uint8_t
month
,
uint8_t
day
,
char
phone
[
10
],
char
first_name
[
20
],
char
last_name
[
20
]);
record_t
*
create_record
(
uint16_t
year
,
uint8_t
month
,
uint8_t
day
,
char
phone
[
10
],
char
first_name
[
20
],
char
last_name
[
20
]);
record_t
*
record_prompt
();
record_t
*
record_prompt
();
void
print_record
(
record_t
record
);
void
print_record
(
record_t
record
);
database_t
*
create_database
();
void
database_add
(
database_t
*
d
,
record_t
*
record
);
void
database_remove
(
database_t
*
v
,
int
index
);
void
database_print
(
database_t
*
d
);
void
database_free
(
database_t
*
d
);
#endif
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment