The Address Book is a simple console-based application designed to manage contact information. It allows users to store, search, edit, and delete contact records. This project simulates a real-world scenario of developing a personal information management tool. The system will operate in a text-based interface and use a local data file for persistent storage.
- Add a new contact
- View all contacts
- Edit existing contact information
- Delete a contact
- Search for a contact by name or phone number
- Save and load contact data from a file
Text-based menu with interactive options (no TUI/GUI).
- Add / Edit / Remove contact
- Search (by name or phone)
- List all contacts
- Exit with auto-save
- OOP design ensures readability and flexibility.
- Encapsulation and Abstraction hides common and separates specialized behavior.
- Polymorphism unified handling of all types via virtual methods.
- Separation of Concerns between UI, Core, I/O, and Search.
- Open/Closed Principle new contact types can be added easily.
- Interface Segregation and Dependency Inversion UI layer decoupled from core logic.
- Strategy Pattern modular search algorithms without changing the core logic.
- Factory Pattern dynamic creation of objects from file data.
- RAII and Smart Pointers unique_ptr ensures safe memory management.
- STL Containers vector used for flexible and efficient contact storage.
- Persistence layer abstracts file reading/writing logic.
- Consistent Data uniform text representation makes saving/loading clearn and extendable.
- Defensive Programming and Input Validation
- Testable Architecture components can be tested independently
AddressBook/
├── AddressBook.h/.cpp # Core contact storage logic
├── FileManager.h/.cpp # File input/output layer
├── Interface.h/.cpp # Console UI controller
├── InterfaceFormatter.h/.cpp
├── Person.h/.cpp # Abstract base for contacts
├── Student.h/.cpp # Derived contact type
├── Teacher.h/.cpp
├── Colleague.h/.cpp
├── SearchStrategy.h/.cpp # Search Strategy
├── SearchByName.h/.cpp # Search implementation
├── SearchByPhone.h/.cpp
├── PersonFactory.h/.cpp # Factory for creating contacts
├── ...
├── contacts.txt # Example data file
└── main.cpp # Program entry point
-
Open Visual Studio 2022 (with MSVC)
-
Clone
git clone https://github.com/gavrun/cpp-console-address-book.git
cd cpp-console-address-book
-
Open the project in VS
-
Build Solution (Debug)
-
Run