From 88b0c96605f96d74834af139f545f78050c9cd63 Mon Sep 17 00:00:00 2001 From: Lucas Date: Thu, 26 Feb 2026 15:05:36 +0100 Subject: [PATCH] init --- .gitignore | 12 ++++ README | 8 +++ recap_island/fundamentals/Makefile | 0 recap_island/fundamentals/main.c | 63 +++++++++++++++++++++ recap_island/fundamentals/quotes.c | 0 recap_island/fundamentals/village.h | 0 recap_island/fundamentals/village_manager.c | 0 recap_island/fundamentals/villagers.c | 0 recap_island/proficiencies/strange_list.c | 0 recap_island/proficiencies/strange_list.h | 0 10 files changed, 83 insertions(+) create mode 100644 .gitignore create mode 100644 README create mode 100644 recap_island/fundamentals/Makefile create mode 100644 recap_island/fundamentals/main.c create mode 100644 recap_island/fundamentals/quotes.c create mode 100644 recap_island/fundamentals/village.h create mode 100644 recap_island/fundamentals/village_manager.c create mode 100644 recap_island/fundamentals/villagers.c create mode 100644 recap_island/proficiencies/strange_list.c create mode 100644 recap_island/proficiencies/strange_list.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5f2e6b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +*.a +*.lib +*.o +*.obj +*.out + +.idea/ +*~ +*.DotSettings.user + +*.html +*.gz diff --git a/README b/README new file mode 100644 index 0000000..311972c --- /dev/null +++ b/README @@ -0,0 +1,8 @@ +dP dP +88 88 +88d888b. dP dP 88d8b.d8b. 88d888b. dP dP 88d8b.d8b. +88' `88 88 88 88'`88'`88 88' `88 88 88 88'`88'`88 +88 88 88. .88 88 88 88 88 88 88. .88 88 88 88 +dP dP `88888P' dP dP dP dP dP `88888P' dP dP dP + + diff --git a/recap_island/fundamentals/Makefile b/recap_island/fundamentals/Makefile new file mode 100644 index 0000000..e69de29 diff --git a/recap_island/fundamentals/main.c b/recap_island/fundamentals/main.c new file mode 100644 index 0000000..3faf606 --- /dev/null +++ b/recap_island/fundamentals/main.c @@ -0,0 +1,63 @@ +#include +#include + +#include "village.h" + +int main() +{ + struct villager *island = NULL; + unsigned int population = 0; + + printf("--- Welcome to the Animal Crossing Management System ---\n"); + + struct villager v1 = { + "Tom Nook", + 45, + SELLER, + "I'll need those Bells, yes yes!", + }; + struct villager v2 = { + "K.K. Slider", + 25, + MUSICIAN, + "The music wants to be free, man. Rock on.", + }; // Longest + struct villager v3 = { + "Blathers", + 40, + WORKER, + "Hoo!", + }; + + add_villager(&island, &population, v1); + add_villager(&island, &population, v2); + add_villager(&island, &population, v3); + + printf("Current Island Population: %u villagers.\n", population); + + printf("\n[Step 1] Exporting quotes to 'bulletin_board.txt'...\n"); + int list_status = list_quotes("bulletin_board.txt", island, population); + if (list_status != 0) + { + printf("Error: Could not write to file (Status %d)\n", list_status); + } + + printf("[Step 2] Searching for the second longest quote in the file...\n"); + char *second = second_longest_quote("bulletin_board.txt"); + + if (second) + { + printf("SUCCESS! The second longest quote is: \"%s\"\n", second); + free(second); + } + else + { + printf("FAILURE: No second longest quote found (File too short or " + "NULL).\n"); + } + + clear_village(&island, &population); + printf("\nIsland closed for maintenance. See you tomorrow!\n"); + + return 0; +} diff --git a/recap_island/fundamentals/quotes.c b/recap_island/fundamentals/quotes.c new file mode 100644 index 0000000..e69de29 diff --git a/recap_island/fundamentals/village.h b/recap_island/fundamentals/village.h new file mode 100644 index 0000000..e69de29 diff --git a/recap_island/fundamentals/village_manager.c b/recap_island/fundamentals/village_manager.c new file mode 100644 index 0000000..e69de29 diff --git a/recap_island/fundamentals/villagers.c b/recap_island/fundamentals/villagers.c new file mode 100644 index 0000000..e69de29 diff --git a/recap_island/proficiencies/strange_list.c b/recap_island/proficiencies/strange_list.c new file mode 100644 index 0000000..e69de29 diff --git a/recap_island/proficiencies/strange_list.h b/recap_island/proficiencies/strange_list.h new file mode 100644 index 0000000..e69de29