This project is a Command Line Interface (CLI) application developed as a final project for my C Programming course. It simulates a basic library system where administrators can manage books, customers, and rental transactions.
The system uses File Handling to ensure data persistence, meaning all records (books, users, rentals) are saved to text files and retrieved upon restarting the program.
- Create Customer: Register new users with ID, name, age, and initial wallet balance.
- Update Customer: Modify existing user details.
- Deposit Money: Add funds to a customer's wallet to facilitate rentals.
- List Customers: View a database of all registered users.
- Add Books: Input book details (Title, Author, Age Limit, Price per Week).
- Update Books: Edit details of existing books.
- Burn Book: Permanently remove a book from the system (only if not currently rented).
- List Books: View inventory and check rental status (Available/Rented).
- Rent a Book: * Validates customer age against book age limit.
- Checks customer wallet balance.
- Calculates cost based on rental duration (weeks).
- Updates inventory status automatically.
- Deliver (Return) Book:
- Returns the book to inventory.
- Refund Policy: Automatically refunds 1 week's worth of fees to the customer upon return.
- Track Rentals: List all active rentals.
- Language: C
- Data Structures:
structused for Customers, Books, and Rentals. - Persistence:
fprintfandfscanfused to store data in CSV-style text files (customers.txt,books.txt,rented.txt). - Logic: Input validation for existing IDs, sufficient funds, and age restrictions.
-
Clone the repository
git clone [https://github.com/ahsndrmz05/library_management_system_inC.git](https://github.com/ahsndrmz05/library_management_system_inC.git)
-
Compile the code You need a C compiler (like GCC). Run the following command in your terminal:
gcc main.c -o library_app
(Note: It is recommended to rename the source file to
main.cfor easier compilation) -
Run the application
./library_app
main.c: The main source code.customers.txt: Stores user ID, Name, Surname, Age, and Wallet Balance.books.txt: Stores Book ID, Title, Author, Age Limit, Price, and Rental Status.rented.txt: Links Customer IDs to Book IDs and tracks rental dates.
Ahsen Durmaz Computer Engineering Student