An open API service indexing awesome lists of open source software.

https://github.com/misaghmomenib/phonebook-cpp

A Phone Book Application Built With C++, Designed to Efficiently Manage Your Contacts. This Project Includes Features Like Adding, Searching, Editing, and Deleting Contact Details. It's a Simple Yet Powerful Tool to Demonstrate C++ Fundamentals and Object-oriented Programming Concepts.
https://github.com/misaghmomenib/phonebook-cpp

cpp git open-source phonebook

Last synced: 2 months ago
JSON representation

A Phone Book Application Built With C++, Designed to Efficiently Manage Your Contacts. This Project Includes Features Like Adding, Searching, Editing, and Deleting Contact Details. It's a Simple Yet Powerful Tool to Demonstrate C++ Fundamentals and Object-oriented Programming Concepts.

Awesome Lists containing this project

README

          

# πŸ“‡ PhoneBook (C++)

A simple yet powerful **console‑based phone book application** in modern C++ (C++11+), allowing you to store, search, edit, and delete contact details with ease.

---

## πŸ“‹ Table of Contents

1. [Overview](#overview)
2. [Features](#features)
3. [Tech Stack & Requirements](#tech-stack--requirements)
4. [Installation & Build](#installation--build)
5. [Usage Examples](#usage-examples)
6. [Code Structure](#code-structure)
7. [Persistence & File Format](#persistence--file-format)
8. [Extensibility & Tips](#extensibility--tips)
9. [Contributing](#contributing)
10. [License](#license)

---

## πŸ’‘ Overview

This application manages a simple phone book using a console menu interface. You can add, view, search, update, and delete contacts. It's a great foundation for learning file I/O, data structures, and modular C++ program design.

---

## βœ… Features

- βž• **Add contacts** with name, phone number, email, and (optional) address
- πŸ” **Search contacts** by name or part of name
- πŸ“ **Edit contacts** to update any field
- ❌ **Delete contacts** safely with confirmation
- πŸ“„ **List all contacts** in tabular format
- πŸ’Ύ **Persistent storage** via a JSON or CSV‑like file (e.g., `contacts.db`)
- πŸ” **Console menu** for easy navigation

---

## πŸ› οΈ Tech Stack & Requirements

- **C++11+** (compatible with g++, clang++, or MSVC)
- Uses ``, ``, ``, `` from standard library
- No external dependencies or frameworks

---

## βš™οΈ Installation & Build

```bash
git clone https://github.com/MisaghMomeniB/PhoneBook-Cpp.git
cd PhoneBook-Cpp
g++ -std=c++11 -o phonebook src/*.cpp
````

Or, using CMake:

```bash
mkdir build && cd build
cmake ..
make
```

Runs on:

* **Linux/macOS**: `./phonebook`
* **Windows**: `phonebook.exe`

---

## πŸš€ Usage Examples

On startup:

```
=== PHONE BOOK ===
1) Add Contact
2) Search Contact
3) Edit Contact
4) Delete Contact
5) List All Contacts
6) Exit
Select option:
```

### Add Contact:

```
Enter name: Alice Smith
Enter phone number: +1-555-1234
Enter email: alice@example.com
Enter address (optional): 123 Maple St
βœ… Contact added with ID 3
```

### Search:

```
Search term: Alice
Found:
ID: 3 | Name: Alice Smith | Phone: +1-555-1234 | Email: alice@example.com
```

### Edit:

```
Enter ID: 3
New name (current: Alice Smith): Alicia Smith
...updates...
βœ… Contact updated.
```

---

## πŸ“ Code Structure

```
PhoneBook-Cpp/
β”œβ”€β”€ src/
β”‚ β”œβ”€β”€ main.cpp # Entry point + menu logic
β”‚ β”œβ”€β”€ PhoneBook.cpp # Core class implementation
β”‚ β”œβ”€β”€ Contact.cpp # Contact entity class
β”‚ └── utils.cpp # File I/O & validation helpers
β”œβ”€β”€ include/
β”‚ β”œβ”€β”€ PhoneBook.hpp
β”‚ β”œβ”€β”€ Contact.hpp
β”‚ └── utils.hpp
└── README.md # This file
```

* `Contact` holds data fields & validation
* `PhoneBook` manages contact list and CRUD operations
* `utils` handles file read/write (JSON/CSV) and input checks

---

## πŸ’Ύ Persistence & File Format

Contacts are saved to `contacts.db` (structured in JSON or CSV format):

```json
[
{
"id": 1,
"name": "Alice Smith",
"phone": "+1-555-1234",
"email": "alice@example.com",
"address": "123 Maple St"
},
...
]
```

Upon launch, it loads the file; changes are saved after operations.

---

## πŸ”§ Extensibility & Tips

* πŸ—‚οΈ Support multiple formats (XML, SQLite DB)
* πŸ”’ Add grouping/tags (family, work, etc.)
* πŸ•΅οΈβ€β™‚οΈ Add fuzzy search or phone/email validation via regex
* 🌐 Add CSV import/export option
* πŸ“œ Architect GUI version later using Qt or ncurses

---

## 🀝 Contributing

Contributions welcome! To add features or improvements:

1. Fork the repository
2. Create a branch (`feature/...`)
3. Document changes clearly
4. Submit a Pull Request for review

---

## πŸ“„ License

Licensed under the **MIT License** β€” see `LICENSE` for details.