An educational C++ console application demonstrating array-based record management, CRUD operations, linear search, and structured procedural programming.
The In-Memory Subsystem is a C++ command-line library inventory management application developed to explore fundamental concepts in data structures, record management, and procedural programming.
The system stores book records in a fixed-capacity array, supporting operations such as adding, searching, updating, deleting, displaying, and counting records.
Rather than relying on an external database, the application manages its records directly in memory during execution.
- Understand fixed-capacity array-based storage.
- Implement Create, Read, Update, and Delete (CRUD) operations.
- Apply linear search to locate records.
- Maintain record uniqueness through Book ID checks.
- Practice structured functions and menu-driven control flow.
- Explore the limitations of temporary in-memory storage.
This repository is intended as a learning and portfolio project, not a production-ready database or embedded storage engine.
The application follows a single-process, menu-driven architecture.
User commands are processed through a continuous while loop and a switch statement.
Each supported operation is implemented in a separate function.
const int MAX = 50;
struct Book {
int id;
string title;
string publishyear;
string author;
float price;
int quantity;
};
Book books[MAX];
int countBooks = 0;The system uses a global array with capacity for 50 book records.
The countBooks variable tracks the number of active records.
Memory considerations:
- The number of book records is limited to 50.
- Book records are stored in an array.
- Text fields use
std::string, which may allocate memory dynamically. - Records remain available only while the program is running.
- No database or file-based persistence is implemented.
| Feature | Description |
|---|---|
| Add Book | Insert a book with its ID, title, publication year, author, price, and quantity |
| Display Books | Display stored book records |
| Search by ID | Locate a record using its Book ID |
| Update Book | Modify an existing book's price and quantity |
| Delete Book | Remove a record and shift subsequent records |
| Count Books | Display the number of active records |
| Search by Name | Search for a book using an exact title match |
| Exit | Terminate the application |
Before adding a new book, the application scans existing records to check whether the requested Book ID is already present.
If a matching ID exists, the insertion is rejected.
The application also checks whether the maximum record capacity has been reached.
Let N represent the number of active records.
| Operation | Time Complexity | Explanation |
|---|---|---|
| Add Book | O(N) | Checks existing IDs before insertion |
| Display Books | O(N) | Iterates through stored records |
| Search by ID | O(N) | Uses linear search |
| Search by Name | O(N) | Uses linear search with exact title matching |
| Update Book | O(N) | Searches for the ID before modifying fields |
| Delete Book | O(N) | Searches and shifts subsequent records |
| Count Books | O(1) | Reads the active record counter |
These complexities describe the record-level operations. String comparisons and copying can add costs depending on text length.
| Component | Implementation |
|---|---|
| Programming Language | C++ |
| Language Standard | C++11 or later |
| Application Type | Console / CLI |
| Storage | Fixed-capacity array |
| Maximum Records | 50 |
| Record Model | C++ struct |
| Search Method | Linear search |
| Control Flow | while loop and switch statement |
| Persistence | None |
| External Libraries | None required |
| Database | Not required |
The project uses standard C++ facilities and does not require third-party packages.
Install a C++ compiler supporting C++11 or later, such as GCC or Clang.
Git is required if you intend to clone the repository.
git clone https://github.com/abdullah-dev-stack/IN-MEMORY-SUBSYSTEM-CPP.gitcd IN-MEMORY-SUBSYSTEM-CPPFor Linux or macOS using GCC:
g++ -std=c++11 in_memory_subsystem.cpp -o bookstore./bookstoreUsing MinGW-w64 GCC:
g++ -std=c++11 in_memory_subsystem.cpp -o bookstore.exeRun the executable:
.\bookstore.exeThe application presents the following menu:
===== Library Management System =====
1. Add Book
2. Display All Books
3. Search Book
4. Update Book
5. Delete Book
6. Count Books
7. Search by book name
8. Exit
Enter your choice:
- Start the application.
- Select
1to add a book. - Enter the Book ID, title, publication year, author, price, and quantity.
- Select
2to display the stored records. - Select
3to search by Book ID. - Select
4to update price or quantity. - Select
5to delete a record. - Select
6to count active records. - Select
7to search by exact book title. - Select
8to exit.
All records are temporary and are lost when the program terminates.
This project is designed for educational use and has several known limitations:
- The application supports a maximum of 50 records.
- Data is not saved between program executions.
- Invalid numeric input is not comprehensively handled.
- Text searches require exact title matches.
- The program uses global variables for record storage.
- No automated test suite or CI pipeline is currently included.
- Monetary values use
float, which is not ideal for production financial calculations. - The application is not designed for concurrent access or production workloads.
These limitations provide opportunities for further learning and improvement.
Potential improvements include:
- Strengthen numeric input validation.
- Add automated tests for CRUD operations.
- Introduce file-based persistence.
- Improve record searching and filtering.
- Add GitHub Actions for automated builds.
- Refactor global state into a dedicated C++ class.
- Improve error handling and user feedback.
- Expand developer and contributor documentation.
These items are planned possibilities and are not part of the current implementation.
Developing this project provides practical experience with:
- C++ structures and arrays.
- Function-based program organization.
- CRUD operation implementation.
- Linear search algorithms.
- Fixed-capacity data management.
- Console input and output.
- Record deletion through element shifting.
- Basic time-complexity analysis.
- Understanding the difference between temporary memory storage and persistent databases.
These fundamentals are relevant to further study in systems programming, embedded software, and application development.
This project is distributed under the MIT License.
See the LICENSE file for details.
Abdullah Khan
Computer Science Undergraduate
Interested in C++, Systems Programming, Software Engineering, and Practical Software Development.
Built to strengthen fundamental programming and data-structure skills through practical C++ development.