init
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
|||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
*.out
|
||||||
|
|
||||||
|
.idea/
|
||||||
|
*~
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
*.html
|
||||||
|
*.gz
|
||||||
@@ -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
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user