This is an enhanced library inventory management system that allows librarians to efficiently track books, authors, and copy counts. The program features intelligent duplicate detection, robust input validation, and professional formatting for inventory management.
- Smart Book Entry: Add books by entering title and author
- Intelligent Duplicate Detection: Automatically identifies duplicate books (case-insensitive)
- Copy Counting: Tracks multiple copies of the same book
- Professional Display: Formatted inventory summary with totals
- Input Validation: Prevents empty entries and invalid data
- Case-Insensitive Matching: "Harry Potter" and "harry potter" are treated as the same book
- Whitespace Handling: Ignores extra spaces in book titles and authors
- File Output: Automatically saves inventory to
book_inventory.txt - Progress Tracking: Shows current progress during data entry
- Error Handling: Graceful handling of input errors and file operations
- Statistical Summary: Displays total unique books and total copies
gcc -o library_inventory library2.c
./library_inventory=== BOOK INVENTORY SYSTEM ===
How many books would you like to enter? 4
--- Book 1 of 4 ---
Book title: The Great Gatsby
Author: F. Scott Fitzgerald
Added new book: 'The Great Gatsby' by F. Scott Fitzgerald
--- Book 2 of 4 ---
Book title: 1984
Author: George Orwell
Added new book: '1984' by George Orwell
--- Book 3 of 4 ---
Book title: the great gatsby
Author: f. scott fitzgerald
Added copy of 'The Great Gatsby' by F. Scott Fitzgerald (now 2 copies)
--- Book 4 of 4 ---
Book title: To Kill a Mockingbird
Author: Harper Lee
Added new book: 'To Kill a Mockingbird' by Harper Lee
==================================================
INVENTORY SUMMARY
==================================================
Title Author Copies
--------------------------------------------------
The Great Gatsby F. Scott Fitzgerald 2
1984 George Orwell 1
To Kill a Mockingbird Harper Lee 1
--------------------------------------------------
Total unique books: 3
Total book copies: 4
==================================================
Inventory saved to 'book_inventory.txt'
The program creates a book_inventory.txt file containing a formatted list of all books for record-keeping and sharing.
- Modular Design: Code organized into logical functions
- Input Validation: Comprehensive error checking and user-friendly prompts
- Memory Safety: Proper string handling and bounds checking
- Professional Formatting: Clean, readable output with proper alignment
get_book_count(): Validates and retrieves number of books to enterget_book_info(): Handles book data input with validationfind_book(): Intelligent duplicate detection with case-insensitive matchingadd_book(): Manages adding new books or updating existing copiesdisplay_inventory(): Professional formatting of inventory datasave_to_file(): Persistent storage of inventory data
- Structs and Arrays: Efficient data organization
- String Manipulation: Case conversion, whitespace handling, comparison
- File I/O: Reading from and writing to files
- Input Validation: Robust user input handling
- Modular Programming: Function-based code organization
- Error Handling: Graceful failure management
- Boolean Logic: Duplicate detection algorithms
- Search Functionality: Find books by title or author
- Edit/Delete Options: Modify or remove existing entries
- Load from File: Import existing inventory data
- Sort Options: Organize by title, author, or copy count
- CSV Export: Export data for spreadsheet applications
- Book Details: Add ISBN, genre, publication year
- Low Stock Alerts: Notification when copies are running low
- Database Integration: SQLite support for larger libraries
- Barcode Scanning: Integration with barcode readers
- User Management: Track who borrowed which books
- Due Date Tracking: Library checkout system
- Reports: Generate usage statistics and reports
- v1.0: Basic inventory tracking with duplicate detection
- v2.0: Enhanced input validation, file output, case-insensitive matching, professional formatting
This project demonstrates progression from basic C programming to more sophisticated software design principles, making it suitable for real-world library management scenarios.
This repository also includes earlier versions of the program:
library_inventory_count.c: An experimental version focused on counting logiclibrary2.c: Current and most up-to-date version
Only library2.c is actively maintained. Other files are kept for reference and historical context.