From d3645f663c32d47d790edb43ee3d39cd79782e1a Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 11 Feb 2026 13:20:47 +0100 Subject: [PATCH] jaunes --- HolidayTrip/Fundamentals/my_strings/Makefile | 14 ++++ HolidayTrip/Fundamentals/my_strings/main.c | 24 +++++++ .../Fundamentals/my_strings/my_strings.c | 66 ++++++++++++++++++ .../Fundamentals/my_strings/my_strings.h | 17 +++++ HolidayTrip/Fundamentals/radar/Makefile | 15 ++++ HolidayTrip/Fundamentals/radar/main | Bin 0 -> 16200 bytes HolidayTrip/Fundamentals/radar/main.c | 43 ++++++++++++ HolidayTrip/Fundamentals/radar/radar.c | 31 ++++++++ HolidayTrip/Fundamentals/radar/radar.h | 16 +++++ .../Fundamentals/reap_and_tear/Makefile | 16 +++++ .../Fundamentals/reap_and_tear/demon.c | 0 .../Fundamentals/reap_and_tear/demon.h | 37 ++++++++++ HolidayTrip/Fundamentals/reap_and_tear/main | Bin 0 -> 16224 bytes HolidayTrip/Fundamentals/reap_and_tear/main.c | 14 ++++ .../Fundamentals/reap_and_tear/print.c | 0 .../Fundamentals/reap_and_tear/villager.c | 0 .../Fundamentals/reap_and_tear/villager.h | 28 ++++++++ .../Fundamentals/reap_and_tear/weapons.c | 17 +++++ .../Fundamentals/reap_and_tear/weapons.h | 24 +++++++ HolidayTrip/Proficiencies/animals/Makefile | 14 ++++ HolidayTrip/Proficiencies/animals/animals.h | 0 HolidayTrip/Proficiencies/animals/fish.c | 0 HolidayTrip/Proficiencies/animals/insect.c | 0 HolidayTrip/Proficiencies/animals/main.c | 7 ++ HolidayTrip/Proficiencies/animals/vector.c | 0 HolidayTrip/Proficiencies/animals/vector.h | 0 .../Proficiencies/museum_restoration/Makefile | 14 ++++ .../museum_restoration/fossils.c | 0 .../museum_restoration/fossils.h | 0 .../Proficiencies/museum_restoration/main.c | 6 ++ 30 files changed, 403 insertions(+) create mode 100644 HolidayTrip/Fundamentals/my_strings/Makefile create mode 100644 HolidayTrip/Fundamentals/my_strings/main.c create mode 100644 HolidayTrip/Fundamentals/my_strings/my_strings.c create mode 100644 HolidayTrip/Fundamentals/my_strings/my_strings.h create mode 100644 HolidayTrip/Fundamentals/radar/Makefile create mode 100755 HolidayTrip/Fundamentals/radar/main create mode 100644 HolidayTrip/Fundamentals/radar/main.c create mode 100644 HolidayTrip/Fundamentals/radar/radar.c create mode 100644 HolidayTrip/Fundamentals/radar/radar.h create mode 100644 HolidayTrip/Fundamentals/reap_and_tear/Makefile create mode 100644 HolidayTrip/Fundamentals/reap_and_tear/demon.c create mode 100644 HolidayTrip/Fundamentals/reap_and_tear/demon.h create mode 100755 HolidayTrip/Fundamentals/reap_and_tear/main create mode 100644 HolidayTrip/Fundamentals/reap_and_tear/main.c create mode 100644 HolidayTrip/Fundamentals/reap_and_tear/print.c create mode 100644 HolidayTrip/Fundamentals/reap_and_tear/villager.c create mode 100644 HolidayTrip/Fundamentals/reap_and_tear/villager.h create mode 100644 HolidayTrip/Fundamentals/reap_and_tear/weapons.c create mode 100644 HolidayTrip/Fundamentals/reap_and_tear/weapons.h create mode 100644 HolidayTrip/Proficiencies/animals/Makefile create mode 100644 HolidayTrip/Proficiencies/animals/animals.h create mode 100644 HolidayTrip/Proficiencies/animals/fish.c create mode 100644 HolidayTrip/Proficiencies/animals/insect.c create mode 100644 HolidayTrip/Proficiencies/animals/main.c create mode 100644 HolidayTrip/Proficiencies/animals/vector.c create mode 100644 HolidayTrip/Proficiencies/animals/vector.h create mode 100644 HolidayTrip/Proficiencies/museum_restoration/Makefile create mode 100644 HolidayTrip/Proficiencies/museum_restoration/fossils.c create mode 100644 HolidayTrip/Proficiencies/museum_restoration/fossils.h create mode 100644 HolidayTrip/Proficiencies/museum_restoration/main.c diff --git a/HolidayTrip/Fundamentals/my_strings/Makefile b/HolidayTrip/Fundamentals/my_strings/Makefile new file mode 100644 index 0000000..f95f99a --- /dev/null +++ b/HolidayTrip/Fundamentals/my_strings/Makefile @@ -0,0 +1,14 @@ +CC=gcc +SRC = my_strings.c main.c +CFLAGS= -Wall -Wextra -Werror +LDFLAGS= -fsanitize=address -g +# Computes the basic main for tests +main: ${SRC} + gcc $(CFLAGS) $^ -o main -lm + +#Check for memory errors/leaks and to use gdb +debug: ${SRC} + gcc $(CFLAGS) $^ -o debug $(LDFLAGS) + +clean: + $(RM) main debug \ No newline at end of file diff --git a/HolidayTrip/Fundamentals/my_strings/main.c b/HolidayTrip/Fundamentals/my_strings/main.c new file mode 100644 index 0000000..cbadf85 --- /dev/null +++ b/HolidayTrip/Fundamentals/my_strings/main.c @@ -0,0 +1,24 @@ +#include + +#include "my_strings.h" + +int main(){ + + +// struct string *str = my_str_init("Hello World!", 12); + // printf("data: %.*s\n", (int)str->size, str->data); + + + //struct string *str = my_str_init("Hello World!", 12); + //my_str_destroy(str); + + //struct string *str = my_str_init("Hello Alien World!", 18); + //my_str_puts(str); +// my_str_destroy(str); + + struct string *str = my_str_init("Hello ", 6); + str = my_str_n_cat(str, "Alien World!", 13); + my_str_puts(str); + my_str_destroy(str); + +} diff --git a/HolidayTrip/Fundamentals/my_strings/my_strings.c b/HolidayTrip/Fundamentals/my_strings/my_strings.c new file mode 100644 index 0000000..1618e9e --- /dev/null +++ b/HolidayTrip/Fundamentals/my_strings/my_strings.c @@ -0,0 +1,66 @@ +#include "my_strings.h" +#include +#include +#include +//' -> ' est un racc pour *rslt.data +struct string *my_str_init(const char* s, size_t size){ + + struct string *rslt = malloc(sizeof(struct string)); + if(rslt == NULL) return NULL; + + if(size == 0 || s == NULL) { + rslt->data = NULL; + rslt->size = 0; + } + else{ + rslt->data = malloc(size); + if(rslt->data == NULL){ + free(rslt); + return NULL; + } + + memcpy(rslt->data, s, size); + rslt->size = size; + } + return rslt; +} + +void my_str_destroy(struct string *str){ + + if(str == NULL) return; + + free(str->data); + free(str); +} + +void my_str_puts(struct string *str){ + + if(str == NULL) return; + + + if(str->data == NULL || str->size == 0)printf("\n"); + + for (size_t i = 0; i < str->size; i++) putchar(*((str->data) + i)); +} + +struct string *my_str_n_cat(struct string *str1, const char *str2, size_t str2_len){ + + if (str2 == NULL || str2_len == 0) return str1; + + if (str1 == NULL){ + struct string *rslt = my_str_init(str2, str2_len); + return rslt; + } + + str1->data = realloc(str1->data, (str1->size + str2_len) * sizeof(char)); + if(str1 == NULL) return str1; + + //printf("test"); + int index = 0; + while (*(str2 + index)){ + str1->data[str1->size + index] = str2[index]; + index ++; + } + str1->size = str1->size + index; + return str1; +} diff --git a/HolidayTrip/Fundamentals/my_strings/my_strings.h b/HolidayTrip/Fundamentals/my_strings/my_strings.h new file mode 100644 index 0000000..6eb2df2 --- /dev/null +++ b/HolidayTrip/Fundamentals/my_strings/my_strings.h @@ -0,0 +1,17 @@ +#ifndef MY_STRINGS_H +#define MY_STRINGS_H +#include + +struct string{ + char *data; + size_t size; +}; + +struct string *my_str_init(const char* s, size_t size); + +void my_str_destroy(struct string *str); +void my_str_puts(struct string *str); +struct string *my_str_n_cat(struct string *str1, const char *str2, size_t str2_len); + + +#endif diff --git a/HolidayTrip/Fundamentals/radar/Makefile b/HolidayTrip/Fundamentals/radar/Makefile new file mode 100644 index 0000000..fc90d0a --- /dev/null +++ b/HolidayTrip/Fundamentals/radar/Makefile @@ -0,0 +1,15 @@ +CC=gcc +SRC = radar.c main.c +CFLAGS= -Wall -Wextra -Werror +LDFLAGS= -fsanitize=address -g -lm + +# Computes the basic main for tests +main: ${SRC} + gcc $(CFLAGS) $^ -o main -lm + +#Check for memory errors/leaks and to use gdb +debug: ${SRC} + gcc $(CFLAGS) $^ -o debug $(LDFLAGS) + +clean: + $(RM) main debug diff --git a/HolidayTrip/Fundamentals/radar/main b/HolidayTrip/Fundamentals/radar/main new file mode 100755 index 0000000000000000000000000000000000000000..f0bc883ac22d955749d4e7431e440ae8dc40cdcb GIT binary patch literal 16200 zcmeHOeQX@X6`ylrVgm68#3Y13jwp!&Bo{kz(f~<0C%$AI<-;U)6x7ho*>{dl*mve` z4Nh80Aa#|KWg1$6XoUp-w2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!{4$H%XLVO3 z_TKwf?DJ8^u4{}+i?q)JhMwaz^_6(!`9trK5<9AH+0$UEtsdvnt|-=^Qq2DQYmCNK J9s>`l{tiPlZukHI literal 0 HcmV?d00001 diff --git a/HolidayTrip/Fundamentals/radar/main.c b/HolidayTrip/Fundamentals/radar/main.c new file mode 100644 index 0000000..76fd6a9 --- /dev/null +++ b/HolidayTrip/Fundamentals/radar/main.c @@ -0,0 +1,43 @@ +#include + +#include "radar.h" + +int main(){ + // compute_distance + struct point p1 = { 0.0, 0.0 }; + struct point p2 = { 3.0, 4.0 }; + + double dist = compute_distance(p1, p2); + printf("Distance: %.2f\n", dist); + + // is_in_area + struct point center = { 5.0, 5.0 }; + double radius = 3.0; + + struct point inside_point = { 7.0, 7.0 }; + struct point outside_point = { 9.0, 9.0 }; + + int inside = is_in_area(center, radius, inside_point); + int outside = is_in_area(center, radius, outside_point); + + printf("Inside: %d\n", inside); + printf("Outside: %d\n", outside); + + // detect_points + center.x = 10.0; + center.y = 10.0; + double range = 5.0; + + struct point points[] = { + { 11.0, 11.0 }, + { 10.0, 10.0 }, + { 20.0, 20.0 }, + { 14.0, 13.0 } + }; + + size_t size = sizeof(points) / sizeof(struct point); + + size_t found = detect_points(center, range, points, size); + printf("Total found: %zu\n", found); + +} diff --git a/HolidayTrip/Fundamentals/radar/radar.c b/HolidayTrip/Fundamentals/radar/radar.c new file mode 100644 index 0000000..e5700cb --- /dev/null +++ b/HolidayTrip/Fundamentals/radar/radar.c @@ -0,0 +1,31 @@ +#include "radar.h" +#include +#include +#include +#include + +double compute_distance(struct point a, struct point b){ + + return sqrt( pow((b.x - a.x),2) + pow((b.y - a.y),2) ); +} + +int is_in_area(struct point center, double radius, struct point point){ + + int rslt = compute_distance(center, point); + + if(rslt > radius) return 0; + return 1; +} + +size_t detect_points(struct point center, double range, struct point *interesting_points, size_t nb_points){ + + size_t found = 0; + for(size_t i = 0; i < nb_points; i++){ + + if(is_in_area(center, range,interesting_points[i]) == 1){ + printf("{ %f, %f }\n",interesting_points[i].x, interesting_points[i].y); + found ++; + } + } + return found; +} diff --git a/HolidayTrip/Fundamentals/radar/radar.h b/HolidayTrip/Fundamentals/radar/radar.h new file mode 100644 index 0000000..5f71c70 --- /dev/null +++ b/HolidayTrip/Fundamentals/radar/radar.h @@ -0,0 +1,16 @@ +#ifndef RADAR_H +#define RADAR_H +#include + +struct point +{ + double x; + double y; +}; + +double compute_distance(struct point a, struct point b); +int is_in_area(struct point center, double radius, struct point point); +size_t detect_points(struct point center, double range, struct point* interesting_points, size_t nb_points); + + +#endif diff --git a/HolidayTrip/Fundamentals/reap_and_tear/Makefile b/HolidayTrip/Fundamentals/reap_and_tear/Makefile new file mode 100644 index 0000000..aee9024 --- /dev/null +++ b/HolidayTrip/Fundamentals/reap_and_tear/Makefile @@ -0,0 +1,16 @@ +CC=gcc +SRC = villager.c demon.c weapons.c print.c main.c +CFLAGS= -Wall -Wextra -Werror +LDFLAGS= -fsanitize=address -g -lm + +# Computes the basic main for tests +main: ${SRC} + gcc $(CFLAGS) $^ -o main -lm + +#Check for memory errors/leaks and to use gdb +debug: ${SRC} + gcc $(CFLAGS) $^ -o debug $(LDFLAGS) + +clean: + $(RM) main debug + diff --git a/HolidayTrip/Fundamentals/reap_and_tear/demon.c b/HolidayTrip/Fundamentals/reap_and_tear/demon.c new file mode 100644 index 0000000..e69de29 diff --git a/HolidayTrip/Fundamentals/reap_and_tear/demon.h b/HolidayTrip/Fundamentals/reap_and_tear/demon.h new file mode 100644 index 0000000..7e9e0fb --- /dev/null +++ b/HolidayTrip/Fundamentals/reap_and_tear/demon.h @@ -0,0 +1,37 @@ +#ifndef DEMON_H +#define DEMON_H + +#include "villager.h" + +struct villager; + +enum demon_category +{ + PARASITE = 1, + THREAT, + NIGHTMARE, + CALAMITY, + TOM_NOOK +}; + +struct demon { + enum demon_category category; + char name[50]; + int damage; + enum distance range; + int cur_HP; + int HP_max; +}; + +struct demon *init_demon(enum demon_category category, char name[50], int HP_max, int damage, enum distance range); +void pp_demon(struct demon *demon); +void destroy_demon(struct demon *demon); +void basic_attack(struct demon *demon, struct villager *target); +void draining_attack(struct demon *demon, struct villager *target); +void heavy_attack(struct demon *demon, struct villager *target); +void chase(struct demon *demon, struct villager *villager); +void update_demon_hp(struct demon *demon, int amount); +void demon_action(struct demon *demon, struct villager *villager); + + +#endif diff --git a/HolidayTrip/Fundamentals/reap_and_tear/main b/HolidayTrip/Fundamentals/reap_and_tear/main new file mode 100755 index 0000000000000000000000000000000000000000..64fd9d05dde0f6b854ff5b0a88f6b18e34575396 GIT binary patch literal 16224 zcmeHO4Qw1o6`s2|t@{((P3_igXmYI*lu~@L9mj+wY0i$%SyypllDMc)x?SI$?W6a{ z-CpBVREJrFJnsf9K2cUIQ+lpFjW}ayBdxrI1`~cetN(%|euTko})X@kkz7FzRNh+4T z_?4jJCn$QizL29=9$ZfbNP^XV6q|CFR;%)kTFh~MGmPR#BKgg;-#q&XE^&Q=5>JW= z9b+6%FGirF6wzm;yne^o&x`BXUXbdbM5vD&wWyjr7;iZb{D4y>(N%z>#^)PL+?-}v6>d!tWmFJ^DuluAzY_iakWyHd$aai(i# zYkyaNU$~GB_v(76E~yXM_mvW`T3yGI$_drshr!jeA8o)t+;^sH^;hNA#&>xy`5Yj>ScZK>IQ2J|oGP#PL$j6u~ zUZ1>-deKuXKl8{}@fZZvk04W$_mMnb_gv-hXZU?1d>iu{BaU8pk;^+B9)+V#%jrxN z&yR{$&R6l|BkAQTUg{v-LKTk-T22usORsx=b!noxikEi)DcY)d{X0M;QfEYiqH_4B z!y){$9|1oCegymo_!00U;78#9Gy-q7uKl}l^z~+AcIAmpN*SLo+ri4bar9@+r}Pz9 zw)`A)Wy3FUZe15aj^t_5onNRRZ8%9X4gJo~Yx!A{X~=iJtmUUkrXkw-??a~gdj2v} zdg*SX^he|9xuvm#(VlY8S>xD_J`_^vxCQ2KO@>?7Jp>mt=-7@D7~|N=&k=m|g580p zwoo2Ty{xj(y6yvqDjiSaycom9oL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kE!$~b@wjY-9SiTzz27Sd)v>ndJq}9C*m*TX2CKWO8wsJr|}W_53-$% z!v*hQp8RR7?)CpNIEo1m-od+`=-ZV#v_6<{}Ov|`yXe2x0(=JGHzp0K;kFzcafp%7k?SI3DSPL>g28e zIVh|Br$dgl;5VwBk@wdB0=VkuU&i@@A&I*>{EB}yO5b&zks0FxL)>BLJ$?-iX^*^rF9RoSN7hZbJ|}yJr*NrP3~6{= Q&;NA4V{whg!6T}F0vE`ng8%>k literal 0 HcmV?d00001 diff --git a/HolidayTrip/Fundamentals/reap_and_tear/main.c b/HolidayTrip/Fundamentals/reap_and_tear/main.c new file mode 100644 index 0000000..84ab9f7 --- /dev/null +++ b/HolidayTrip/Fundamentals/reap_and_tear/main.c @@ -0,0 +1,14 @@ +#include + +#include "demon.h" +#include "villager.h" +#include "weapons.h" + +int main() +{ + char gun_name[50] = "BFG"; + struct gun *gun = init_gun(gun_name, 50, FAR, 16); + + printf("Gun name: %s\nDamage: %d\nRange: %d\nMagazine: %d/%d\n", gun->name, gun->damage, gun->range, gun->current_magazine, gun->magazine_size); + +} diff --git a/HolidayTrip/Fundamentals/reap_and_tear/print.c b/HolidayTrip/Fundamentals/reap_and_tear/print.c new file mode 100644 index 0000000..e69de29 diff --git a/HolidayTrip/Fundamentals/reap_and_tear/villager.c b/HolidayTrip/Fundamentals/reap_and_tear/villager.c new file mode 100644 index 0000000..e69de29 diff --git a/HolidayTrip/Fundamentals/reap_and_tear/villager.h b/HolidayTrip/Fundamentals/reap_and_tear/villager.h new file mode 100644 index 0000000..22d777f --- /dev/null +++ b/HolidayTrip/Fundamentals/reap_and_tear/villager.h @@ -0,0 +1,28 @@ +#ifndef VILLAGER_H +#define VILLAGER_H + +#include "weapons.h" +struct demon; + +struct villager{ + char name[50]; + int cur_HP; + int HP_max; +// struct gun; + int gun_mastery; + int medicines; + enum distance distance; +}; + +struct villager *init_villager(char name[50], int HP_max, struct gun *gun, int gun_mastery); +void pp_villager(struct villager *villager); +void destroy_villager(struct villager *villager); +void update_villager_hp(struct villager *villager, int amount); +void shoot(struct villager *villager, struct demon *demon); +void heal(struct villager *villager); +enum distance walk(struct villager *villager, int direction); +int prepare_medicine(struct villager *villager); + + +#endif + diff --git a/HolidayTrip/Fundamentals/reap_and_tear/weapons.c b/HolidayTrip/Fundamentals/reap_and_tear/weapons.c new file mode 100644 index 0000000..5d2cad8 --- /dev/null +++ b/HolidayTrip/Fundamentals/reap_and_tear/weapons.c @@ -0,0 +1,17 @@ +#include "weapons.h" +#include +#include +#include +struct gun *init_gun(char name[50], int damage, enum distance range, int magazine_size){ + + struct gun *rslt = malloc(sizeof( struct gun)); + //mettre protection + + //init des var du struct + strcpy(rslt->name, name); + rslt->damage = damage; + rslt->range = range; + rslt->magazine_size = magazine_size; + + return rslt; +} diff --git a/HolidayTrip/Fundamentals/reap_and_tear/weapons.h b/HolidayTrip/Fundamentals/reap_and_tear/weapons.h new file mode 100644 index 0000000..cc3c2fc --- /dev/null +++ b/HolidayTrip/Fundamentals/reap_and_tear/weapons.h @@ -0,0 +1,24 @@ +#ifndef WEAPONS_H +#define WEAPONS_H + +enum distance +{ + CLOSE, + NEAR, + FAR, +}; + +struct gun { + char name[50]; + int damage; + enum distance range; + int magazine_size; + int current_magazine; +}; + +struct gun *init_gun(char name[50], int damage, enum distance range, int magazine_size); +void reload(struct gun *gun); +void destroy_gun(struct gun *gun); + + +#endif diff --git a/HolidayTrip/Proficiencies/animals/Makefile b/HolidayTrip/Proficiencies/animals/Makefile new file mode 100644 index 0000000..ef8b7bf --- /dev/null +++ b/HolidayTrip/Proficiencies/animals/Makefile @@ -0,0 +1,14 @@ +CC=gcc +SRC = fish.c insects.c vector.c main.c +CFLAGS= -Wall -Wextra -Werror +LDFLAGS= -fsanitize=address -g +# Computes the basic main for tests +main: ${SRC} + gcc $(CFLAGS) $^ -o main -lm + +#Check for memory errors/leaks and to use gdb +debug: ${SRC} + gcc $(CFLAGS) $^ -o debug $(LDFLAGS) + +clean: + $(RM) main debug \ No newline at end of file diff --git a/HolidayTrip/Proficiencies/animals/animals.h b/HolidayTrip/Proficiencies/animals/animals.h new file mode 100644 index 0000000..e69de29 diff --git a/HolidayTrip/Proficiencies/animals/fish.c b/HolidayTrip/Proficiencies/animals/fish.c new file mode 100644 index 0000000..e69de29 diff --git a/HolidayTrip/Proficiencies/animals/insect.c b/HolidayTrip/Proficiencies/animals/insect.c new file mode 100644 index 0000000..e69de29 diff --git a/HolidayTrip/Proficiencies/animals/main.c b/HolidayTrip/Proficiencies/animals/main.c new file mode 100644 index 0000000..ea1c965 --- /dev/null +++ b/HolidayTrip/Proficiencies/animals/main.c @@ -0,0 +1,7 @@ +#include + +#include "animals.h" +#include "vector.h" + +int main() +{} diff --git a/HolidayTrip/Proficiencies/animals/vector.c b/HolidayTrip/Proficiencies/animals/vector.c new file mode 100644 index 0000000..e69de29 diff --git a/HolidayTrip/Proficiencies/animals/vector.h b/HolidayTrip/Proficiencies/animals/vector.h new file mode 100644 index 0000000..e69de29 diff --git a/HolidayTrip/Proficiencies/museum_restoration/Makefile b/HolidayTrip/Proficiencies/museum_restoration/Makefile new file mode 100644 index 0000000..89d3c58 --- /dev/null +++ b/HolidayTrip/Proficiencies/museum_restoration/Makefile @@ -0,0 +1,14 @@ +CC=gcc +SRC = fossils.c main.c +CFLAGS= -Wall -Wextra -Werror +LDFLAGS= -fsanitize=address -g +# Computes the basic main for tests +main: ${SRC} + gcc $(CFLAGS) $^ -o main -lm + +#Check for memory errors/leaks and to use gdb +debug: ${SRC} + gcc $(CFLAGS) $^ -o debug $(LDFLAGS) + +clean: + $(RM) main debug \ No newline at end of file diff --git a/HolidayTrip/Proficiencies/museum_restoration/fossils.c b/HolidayTrip/Proficiencies/museum_restoration/fossils.c new file mode 100644 index 0000000..e69de29 diff --git a/HolidayTrip/Proficiencies/museum_restoration/fossils.h b/HolidayTrip/Proficiencies/museum_restoration/fossils.h new file mode 100644 index 0000000..e69de29 diff --git a/HolidayTrip/Proficiencies/museum_restoration/main.c b/HolidayTrip/Proficiencies/museum_restoration/main.c new file mode 100644 index 0000000..cfd22c1 --- /dev/null +++ b/HolidayTrip/Proficiencies/museum_restoration/main.c @@ -0,0 +1,6 @@ +#include + +#include "fossils.h" + +int main() +{}