You are on page 1of 56

Project Title

(Session 2022-2024)

Submitted By
NAME Mursal bajwa, Huzaifa Azeem, Shakeel ur Rehman
Roll No 22-cs-420, 22-cs-438, 22-cs-426
Supervisor Name
Mam Amna Wajid
_____________________________________________________________________________________________

Department of Computer Science & Engineering


University of Engineering & Technology, Lahore
Pakistan

1|P age
c Project Title

“One machine can do the work of a hundred ordinary men, but no


machine can do the work of one extraordinary man”

(Elbert Hubbard)

2|P age
c Project Title

Table of Contents

Introduction ............................................................................................................................................ 13
1.1 Overview ........................................................................................................................................ 13
1.2 Motivation ..................................................................................................................................... 13
Literature Survey................................................................................................................................... 21
3.1 ........................................................................................................................................................... 21
Problem Statement ............................................................................................................................... 35
4.1Scope ................................................................................................................................................ 35
4.2 Assumptions and Dependencies............................................................................................ 37
4.3 General Constraints ................................................................................................................... 37
Solution and Project Design............................................................................................................... 38
5.1 System Architecture................................................................................................................... 38
5.2 Proposed Solution ...................................................................................................................... 39
5.3 Class Diagram of System.......................................................................................................... .55
Project Implementation ...................................................................................................................... 56
6.1 Screen shots of Project ............................................................................................................. .56
Results ....................................................................................................................................................... 64
8.1 Results ............................................................................................................................................ 64
8.2 Suggestions ................................................................................................................................... 64
Conclusion ................................................................................................................................................ 65
Future Recommendations .................................................................................................................. 66
References................................................................................................................................................ 67
Appendices............................................................................................................................................... 69

3|P age
c Project Title

List of Figures

4|P age
c Project Title

5|P age
c Project Title

Chapter 1

Introduction
1.1 Overview:
SUMMARY :
The Contact Management System is designed to organize and manage contacts
efficiently. It utilizes classes and methods to perform operations such as insertion,
deletion, searching, and editing of contacts. This documentation outlines the
structure, functionalities, and purpose of the code. The Contact Management System
is a console-based application written in C++ to manage and organize contacts. It
allows users to add, delete, search, edit, and display contacts. The system supports
storing contacts in different categories, such as family, work, and friends. Contacts
are sorted alphabetically by name for efficient retrieval.

2 MOTIVATION for PROJECT:

Motivation for the Dynamic Contact Management System Project: In our rapidly
evolving digital age, the ability to manage contacts efficiently has become more
critical than ever. The motivation behind embarking on the development of a
Dynamic Contact Management System using linked lists stems from the need to
address the challenges and complexities that users face in organizing and accessing
their contact information. Here are key motivating factors driving this project: Ever-
Growing Digital Landscape: As the digital landscape continues to expand, individuals
and organizations are accumulating a vast amount of contact information. Managing
this growing dataset necessitates a dynamic and efficient solution. User Convenience
and Experience: Users increasingly demand seamless experiences when dealing with
their contacts. This project aims to provide a user-friendly interface that streamlines
the process of adding, deleting, searching, displaying, and modifying contacts,
enhancing overall user satisfaction. Memory Efficiency with Linked Lists: Leveraging
the dynamic nature of linked lists ensures that the contact management system is not
only effective but also memory-efficient. This is crucial, especially when dealing with
large datasets and frequent operations. Data Integrity and Accuracy: The project's
focus on avoiding duplicate entries ensures that the contact information remains
accurate and reliable. Maintaining data integrity is a fundamental aspect of effective
contact management, and the system is designed to uphold this standard.
Adaptability to Diverse Needs: The inclusion of features such as managing multiple
contact lists and implementing sorting algorithms caters to the diverse organizational
and personal needs of users. The project recognizes the importance of adaptability in
6|P age
c Project Title

addressing a wide range of scenarios. Skill Development and Learning Opportunities:


Beyond the immediate benefits of the contact management system, the project offers
valuable learning opportunities for developers. Implementing algorithms, designing a
user interface, and working with dynamic data structures contribute to skill
development in a real-world context. Contributing to Efficient Contact Management:
Ultimately, the motivation lies in contributing to the efficiency of contact
management in the digital era. By providing a robust, dynamic, and user-centric
solution, the project aims to simplify the lives of users and organizations, allowing
them to focus on meaningful interactions rather than grappling with data
management challenges. In conclusion, the motivation for this project is deeply
rooted in addressing the evolving needs of users in the digital age, providing a
solution that not only meets current challenges but also anticipates future demands.
The prospect of creating a valuable tool for efficient contact management, coupled
with the opportunities for learning and skill enhancement, fuels the enthusiasm
behind this endeavor.

Chapter 3
Problem statement :
Project Proposal:
Dynamic Contact Management System using Linked Lists I. Introduction In the contemporary
digital landscape, efficient contact management is essential. This project aims to develop a
Dynamic Contact Management System using linked lists, enabling users to add, delete,
search, display, and modify contacts seamlessly. The project focuses on utilizing the dynamic
nature of linked lists for memory-efficient operations.

II. Project Description


This section provides an overview of the project's purpose, highlighting the significance of
managing contacts in the digital age. It outlines the core functionalities the system will offer,
emphasizing the dynamic aspect facilitated by linked lists.

III. Features Add Contact:


Users can add new contacts with details such as name, phone number, and email address.
Delete Contact: Existing contacts can be deleted based on name or phone number. Search
Contact: Efficient search functionality based on name or phone number. Display Contact List:
Users can view the complete contact list. Modify Contact Details: Ability to update phone
numbers or email addresses. Avoid Duplicate Entries: Prevents addition of duplicate contacts,
ensuring data integrity.

IV. Implementation Details Data Structure:


Singly linked lists to store contacts, providing efficient insertion and deletion. Algorithms:
Implementing algorithms for insertion, deletion, and searching to handle large datasets.

V. Additional Challenges Multiple Contact Lists:


7|P age
c Project Title

Allowing users to manage multiple contact lists independently. Sorting: Implementing sorting
algorithms for alphabetical ordering of contacts. User Interface: Creation of a user-friendly
interface to enhance user experience.

8|P age
c Project Title

2.1 System Overview


This section provides an overview of the significance of contact management
and emphasizes the dynamic nature facilitated by the implementation of linked
lists.
2.2 Core Functionalities Outlines
the fundamental features of the system, including adding, deleting,
searching, displaying, and modifying contacts, with an emphasis on
data integrity and efficiency.

9|P age
c Project Title

Chapter 4

4.1 .Scope
Data Structure Utilizes singly linked lists for storing contacts,
optimizing insertion and deletion operations.
Algorithms Implements algorithms for insertion, deletion, and
searching to handle large datasets effectively.
The scope of the Contact Management System includes
managing contacts in different categories, performing CRUD
operations, and persisting data to files. The system provides a
user-friendly interface for effective contact management.
4.2 Assumptions and Dependencies:

1.1 - The program assumes that the user will provide valid inputs
during operations.
1.2 - Dependencies include the file I/O
operations for saving and loading contact
data.
4.3 General Constraints:

10 | P a g e
c Project Title

The system is implemented in C++ and may not have a


graphical user interface.
Input validation is limited, and the system assumes correct
user inputs.

*****************************************************

11 | P a g e
c Project Title

Chapter 5

Solution and Project Design

5.1 System Architecture


The program written by the programmer based on link list.The
program's architecture is based on linked lists to manage contacts
efficiently. Here's an overview: Contact Class (contact):
Represents an individual contact with properties such as name,
number, and a pointer next to the next contact in the linked list.
Each contact node holds information for one person. Contact Book
Class (contactbook): Represents a collection of contacts, organized
as a linked list. The contactbook class contains a pointer to the first
contact (firstcontact) in the linked list, and it provides methods for
various operations like insertion, deletion, searching, editing, and
display.
The system follows a simple console-based architecture with three main
classes: `contact`, `contactbook`, and the main `main` function.
Contacts are organized into linked lists within each contact book
category.

5.2 Proposed Solution


The program uses a linked list data structure for efficient contact management. The linked list allows for dynamic
memory allocation and easy insertion and deletion of contacts without the need to shift or resize arrays

`contact` Class
- Represents an individual contact within the system.

- Contains data members:

- `name`: Represents the name of the contact.

- `number`: Represents the contact number.


12 | P a g e
c Project Title

- `next`: A pointer to the next contact, forming a linked list.

- Includes a constructor to initialize the `next` pointer to `NULL`.

`contactbook` Class
- Manages a collection of contacts, organized into linked lists for
different contact categories (Family, Friends, Work).

- Data members:
- `firstcontact`: A pointer to the first contact in the linked list.

- `read` and `write`: File stream objects for reading from and
writing to files.

- Includes a constructor to initialize `firstcontact` to `NULL`.

`main` Function
- Acts as the entry point of the program.

- Creates instances of the `contactbook` class for Family, Friends,


and Work contacts.

- Provides a user interface through console interactions.

- Allows users to perform operations such as insertion, deletion,


searching, editing, and displaying contacts.
13 | P a g e
c Project Title

5.2 Proposed Solution


The proposed solution employs a linked list-based approach for
efficient contact management. Each contact book category
(`contactbook` instance) maintains a linked list of contacts sorted
by name. The design decisions are outlined below:

Linked List Organization


- Contacts are organized as nodes in a linked list, where each
node represents an individual contact.

- Sorting is achieved by inserting new contacts in sorted order


based on the contact names.

File I/O Operations


- Data persistence is implemented using file I/O operations.

- Contacts are read from and written to files during program


execution, ensuring that data is retained between sessions.

14 | P a g e
c Project Title

User Interface
- The user interface is implemented through console interactions,
allowing users to choose contact book categories and perform
operations.

5.3 Class Diagram of System


The class diagram illustrates the relationships and structure of the classes in the system:

```

+----------------+ +------------------+

| contactbook |----------| contact |

+----------------+ +------------------+

| - firstcontact | | - name |

| - read | | - number |

| - write | | - next |

+----------------+ +------------------+

```

The `contactbook` class has associations with the `contact` class, indicating that it manages a
collection of contacts.

In summary, the proposed solution leverages linked lists for efficient contact organization
and file I/O for data persistence. The user interface provides a simple yet effective way for

15 | P a g e
c Project Title

Chapter 6

Project Implementation

6.1 Screen Shots of Project

Screenshots play a crucial role in providing a visual representation of the project's implementation. They serve as
documentation to illustrate the working of the system and can be included to enhance understanding. In the case of the
Contact Management System, capturing key moments of the program's execution through screenshots is beneficial.
Below are the recommended areas to capture:

Main Menu Interaction


Include a screenshot showcasing the main menu of the Contact Management
System. This can help users understand the available options and navigate through
the system effectively. For example:

Contact Insertion
Capture the interaction when a user inserts a new contact. This should display the
input prompts for name and number, followed by a confirmation or error message.
Example:

16 | P a g e
c Project Title

Contact Deletion
Showcase the process of deleting a contact, including the input for the contact's
name or number and the resulting confirmation or error message. Example:

17 | P a g e
c Project Title

Contact Search
Include screenshots demonstrating the search functionality, where users input a name or number,
and the system displays the corresponding contact details or a relevant message. Example:

Contact Editing
Capture the interaction when a user chooses to edit a contact. Display the options for
editing (name or number) and the subsequent input and confirmation messages.
Example:

Displaying Contacts
Include a screenshot showing the display of contacts, illustrating how the system presents the stored contact
information to the user. Example:

Exit and Save Confirmation


Capture the moment when the user decides to exit the program and provide an option to save changes. This can
include a confirmation prompt and, if applicable, a success message for saving data. Exampl

18 | P a g e
c Project Title

Including these screenshots in the documentation adds a visual component to the project, aiding in a more
comprehensive understanding of the Contact Management System's functionality. Each screenshot should be
accompanied by explanatory captions to provide context and guide the reader through the user interactions.

Chapter no 8

19 | P a g e
c Project Title

Results
Results

The Contact Management System has been successfully implemented,


providing efficient contact management across different categories. Users
can perform various operations such as inserting, deleting, searching,
editing, and displaying contacts within the family, friends, and work
categories. The system functions as intended, allowing users to interact
with their contacts in an organized and user-friendly manner.
Suggestions

While the system demonstrates success in its current state, there are areas
where enhancements can be considered for further improvement:

Enhance Input Validation


**Description:**
The system should implement robust input validation mechanisms to
handle unexpected or erroneous user inputs effectively. This is crucial for
ensuring the stability and reliability of the program.

**Suggestions:**
- Validate user inputs for both name and number fields to ensure they
meet required criteria (e.g., length, character types).
- Implement error messages or prompts to guide users when invalid
inputs are detected.
- Consider adding additional safeguards to prevent potential issues
arising from incorrect inputs.

20 | P a g e
c Project Title

**Example:**
If a user enters a name with special characters or a phone number in an
incorrect format, the system should provide a clear error message guiding
the user to input valid data.
Consider Implementing a Graphical User
Interface (GUI)

**Description:**
To enhance user interaction and provide a more intuitive experience,
consider transitioning from a console-based interface to a Graphical User
Interface (GUI). A GUI can improve usability and make the system more
accessible to users who may not be familiar with command-line
interfaces.

**Suggestions:**
- Utilize GUI frameworks or libraries (e.g., Qt, Tkinter) to design an
interface with buttons, input fields, and visual feedback.
- Implement a menu-driven system within the GUI for users to navigate
and interact with the system seamlessly.

**Example:**
Instead of relying on command-line inputs, users can perform operations
by clicking buttons and entering data in a visually appealing GUI. This
can lead to a more user-friendly experience and broaden the system's
appeal.

By addressing these suggestions, the Contact Management System can


further improve its robustness, user-friendliness, and overall user
21 | P a g e
c Project Title

experience. These enhancements contribute to the long-term success and


sustainability of the application, ensuring it remains effective and
adaptable to user needs.

Chapter 9
22 | P a g e
c Project Title

Conclusion of the program:


The Contact Management System offers a structured approach to manage
contacts efficiently. Its classes and methods provide functionalities for
organizing contacts and storing them persistently. # Conclusion

The Contact Management System represents a comprehensive and


efficient solution designed to meet the diverse needs of users in
organizing and managing their contacts across various categories. This
section delves deeper into the key aspects of the system, its functional
contributions, and the impact it has on user contact management.

Functional Solution:

The primary objective of the Contact Management System is to provide a


practical and functional tool for users to organize their contacts
effectively. By offering distinct categories such as family, friends, and
work, the system caters to the multifaceted nature of users' social and
professional connections. The implementation of features such as sorted
insertion, deletion, search, and edit functionalities enhances the overall
utility of the system.

**Efficiency in Contact Handling:**


- The system's success lies in its ability to streamline the contact
management process. Users can efficiently perform tasks such as adding
new contacts, removing outdated entries, and modifying contact details.
The categorization feature ensures that users can navigate through their
contacts seamlessly, minimizing the time and effort required for contact-
related activities.

23 | P a g e
c Project Title

**Adaptability to Different Categories:**


- One of the system's strengths is its adaptability to diverse contact
categories. Users can tailor their contact management approach based on
specific aspects of their lives, be it personal relationships, friendships, or
professional connections. This adaptability adds a layer of customization,
making the system a versatile tool for a wide range of users.
Efficient Tool for Users:

**User-Friendly Interface:**
- The system prioritizes user-friendliness, featuring an interface that is
intuitive and easy to navigate. The straightforward design ensures that
users, regardless of their technical expertise, can leverage the system
efficiently. This accessibility is crucial for a tool intended for a broad user
base.

**Sorted Insertion and Deletion Mechanisms:**


- The inclusion of sorted insertion not only organizes contacts
alphabetically but also contributes to a more structured and readable
contact book. The system's deletion mechanisms, whether by name or
number, provide users with flexibility and control over their contact lists.

**Search and Edit Capabilities:**


- The search and edit functionalities further enhance the system's
efficiency. Users can quickly locate specific contacts using names or
numbers, while the edit feature allows for seamless updates to contact
details. This adaptability ensures that the system remains dynamic in
accommodating changes in users' social and professional circles.

Looking Ahead:

24 | P a g e
c Project Title

While the Contact Management System has demonstrated its


effectiveness, there are always opportunities for improvement and
expansion. Future iterations could explore advanced features, integration
with other platforms, or enhancements in user interaction, ensuring that
the system continues to evolve alongside users' evolving needs.

In conclusion, the Contact Management System not only meets the


immediate requirements of users seeking an organized approach to
contact management but also establishes a foundation for potential
growth and innovation in the realm of digital contact organization tools.
Its functional design, coupled with user-centric features, positions it as a
valuable asset in the digital toolkit of individuals and organizations alike.

25 | P a g e
c Project Title

Appendices

AppendixA

Overview

No specific appendices are included in the current documentation.


However, appendices are typically supplementary materials or
additional information that supports and complements the main
content. In the context of the Contact Management System
documentation, appendices might include detailed technical
specifications, additional diagrams, code snippets, or any other
information that is relevant but not essential to the main narrative.

Purpose of Appendices

1. **Detailed Technical Specifications:**

- In-depth technical details, algorithms, or data structures used in the


implementation of the Contact Management System can be
provided in appendices. This ensures that the main document

26 | P a g e
c Project Title

remains accessible to a broader audience, while those interested in


technical specifics can refer to the appendices.

2. **Code Samples:**

- If the documentation mentions specific code snippets but does not


delve deeply into the code, appendices can be used to include
extended code samples or even the entire source code. This allows
developers or readers with a more technical background to review
the actual implementation.

3. **Additional Diagrams:**

- Supplementary diagrams, such as flowcharts, sequence diagrams, or


any visuals that enhance understanding, can be placed in
appendices. This prevents overwhelming the main document with
too many visuals but provides interested readers with an option to
explore further.

4. **Project Artifacts:**

- Any additional project artifacts, such as wireframes, design mockups,


or testing plans, can be included in appendices. These artifacts may

27 | P a g e
c Project Title

not be crucial for the primary narrative but can add value to readers
seeking a more comprehensive understanding of the project.

Importance of Expanding Appendices


While the current documentation provides a high-level overview, it is
advisable to expand the appendices based on specific project
requirements and findings. This expansion ensures that readers with
different levels of expertise or interests can find the information
they need. Additionally, a well-documented set of appendices can
serve as a valuable resource for future developers, project managers,
or stakeholders.

For instance, if the project involves intricate algorithms or unique design


patterns, including detailed explanations and code samples in the
appendices can be immensely beneficial. Similarly, if there are
specific constraints or dependencies that impact the system, these
details can be clarified in dedicated appendices.

In summary, appendices are an integral part of documentation, providing


a flexible space for supplementary information. Their content can be

28 | P a g e
c Project Title

tailored to the specific needs of the audience, making the


documentation more versatile and informative

Program code.
#include <iostream>

#include <string>

#include <stack>

#include <fstream>

using namespace std;

class contact

public:

string name;

string number;

contact* next;

contact()

next = NULL;

29 | P a g e
c Project Title

};

class contactbook

contact* firstcontact;

ifstream read;

ofstream write;

public:

contactbook()

firstcontact = NULL;

int SmallerName(string passedname, string contactbookname)

if (passedname == contactbookname)

return 2;

30 | P a g e
c Project Title

if (passedname.length() >= contactbookname.length())

for (int i = 0; i < passedname.length(); i++)

if (i < contactbookname.length())

if ((int)passedname[i] < (int)contactbookname[i])

return true;

else

if ((int)passedname[i] > (int)contactbookname[i])

return false;

return false;

else

if (passedname.length() < contactbookname.length())

for (int i = 0; i < contactbookname.length(); i++)

31 | P a g e
c Project Title

if (i < passedname.length())

if ((int)passedname[i] < (int)contactbookname[i])

return true;

else

if ((int)passedname[i] > (int)contactbookname[i])

return false;

return true;

void insertSorted(string Name, string Number) {

contact* temp = firstcontact;

while (temp != NULL && Name != temp->name)

temp = temp->next;

32 | P a g e
c Project Title

if (temp != NULL)

cout << "cant insert the dublicate\n";

return;

else

contact* newcontact = new contact;

newcontact->name = Name;

newcontact->number = Number;

if (firstcontact == NULL || SmallerName(newcontact->name, firstcontact->name) == 1) {

newcontact->next = firstcontact;

firstcontact = newcontact;

else {

contact* current = firstcontact;

contact* prev = NULL;

while (current != NULL && SmallerName(newcontact->name, current->name) == 0) {

prev = current;

current = current->next;

33 | P a g e
c Project Title

newcontact->next = current;

prev->next = newcontact;

void deletionbyname(string Name)

if (firstcontact == NULL)

cout << "Contactbook is empty\n";

else

if (firstcontact->next == NULL && firstcontact->name==Name)

delete firstcontact;

firstcontact = NULL;

else

if (firstcontact->name == Name)

contact* del = firstcontact;

34 | P a g e
c Project Title

firstcontact = firstcontact->next;

delete del;

else

contact* temp = firstcontact;

contact* prev = NULL;

while (temp != NULL && temp->name != Name)

prev = temp;

temp = temp->next;

if (temp != NULL && temp->name == Name)

prev->next = temp->next;

delete temp;

else

cout << "the Name is not found in the contactbook!" << endl;

35 | P a g e
c Project Title

void deletionbynumber(string Number)

if (firstcontact == NULL)

cout << "Contactbook is empty\n";

else

if (firstcontact->next == NULL && firstcontact->number == Number)

delete firstcontact;

firstcontact = NULL;

else

if (firstcontact->number == Number)

contact* del = firstcontact;

firstcontact = firstcontact->next;

delete del;

else

36 | P a g e
c Project Title

contact* temp = firstcontact;

contact* prev = NULL;

while (temp != NULL && temp->number != Number)

prev = temp;

temp = temp->next;

if (temp != NULL && temp->number == Number)

prev->next = temp->next;

delete temp;

else

cout << "the Name is not found in the contactbook!" << endl;

void searchbyname(string Name)

37 | P a g e
c Project Title

contact* temp = firstcontact;

while (temp != NULL && temp->name != Name )

temp = temp->next;

if (temp!=NULL&&temp->name== Name)

cout << "name in the contactbook:" << temp->name << endl;

cout << "number in the contactbook:" << temp->number << endl;

else

cout << "the Name is not found in the contactbook!" << endl;

void searchbynumber(string Number)

contact* temp = firstcontact;

while (temp != NULL && temp->number != Number)

38 | P a g e
c Project Title

temp = temp->next;

if (temp != NULL && temp->number == Number)

cout << "name in the contactbook:" << temp->name << endl;

cout << "number in the contactbook:" << temp->number << endl;

else

cout << "the Number is not found in the contactbook!" << endl;

void Edit(string Name)

contact* temp = firstcontact;

while (temp != NULL && temp->name != Name)

temp = temp->next;

39 | P a g e
c Project Title

if (temp != NULL && temp->name == Name)

int c;

cout << "If you want to edit name press 1:\n";

cout << "If you want to edit number press 2:\n";

cin >> c;

if (c == 1)

string name;

string number = temp->number;

deletionbyname(Name);

cout << "Enter the new name:\n";

cin >> name;

insertSorted(name, number);

else

if (c == 2)

string name = temp->name;

string number;

deletionbyname(Name);

cout << "Enter the new number:\n";

cin >> number;

40 | P a g e
c Project Title

insertSorted(name, number);

else

cout << "the Name is not found in the contactbook!" << endl;

void display()

if (firstcontact == NULL)

cout << "contactbook is Empty!" << endl;

else

contact* temp = firstcontact;

while (temp != NULL)

cout << "name in the contactbook:" << temp->name << endl;

41 | P a g e
c Project Title

cout << "number in the contactbook:" << temp->number << endl;

temp = temp->next;

void writer(string filename)

write.open(filename);

if (!write.is_open()) {

cout << "Error: Unable to open the file." << endl;

return;

contact* temp = firstcontact;

while (temp != NULL)

write << temp->name << " "<< temp->number << " "<<endl;

temp = temp->next;

write.close();

void reader(string filename) {

42 | P a g e
c Project Title

read.open(filename);

if (!read.is_open()) {

cout << "Error: Unable to open the file." << endl;

return;

string name, number;

while (read>>name>>number) {

insertSorted(name, number);

read.close();

~contactbook()

43 | P a g e
c Project Title

};

int main()

cout << "\t\t\t\tWelcome to contact management system!\n";

contactbook Family;

contactbook Friend;

contactbook work;

string name;

string number;

char decision;

int selection=0;

int choice = 0;

do {

cout << "Press 1 to manage family contact:\nPress 2 to manage friends contact:\nPress 3 to


manage work contact:\nPress 4 to exit program:\n";

cin >> selection;

system("cls");

if (selection == 1)

Family.reader("Familycontact");

cout << "Press 1 to insert:\n";

44 | P a g e
c Project Title

cout << "Press 2 to delete by name:\n";

cout << "Press 3 to delete by number:\n";

cout << "Press 4 to search by name:\n";

cout << "Press 5 to search by number:\n";

cout << "press 6 to edit :\n";

cout << "Press 7 to display:\n";

cout << "Press 8 to exit:\n";

cin >> choice;

system("cls");

switch (choice)

case 1:

cout << "Enter name:\n";

cin >> name;

cout << "Enter number:\n";

cin >> number;

Family.insertSorted(name,number);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 2:

cout << "Enter name:\n";

45 | P a g e
c Project Title

cin >> name;

Family.deletionbyname(name);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 3:

cout << "Enter number:\n";

cin >> number;

Family.deletionbynumber(number);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 4:

cout << "Enter name:\n";

cin >> name;

Family.searchbyname(name);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 5:

cout << "Enter number:\n";

cin >> number;


46 | P a g e
c Project Title

Family.searchbynumber(number);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 6:

cout << "Enter name:\n";

cin >> name;

Family.Edit(name);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 7:

Family.display();

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 8:

char c;

cout << "Do you want to save?Press y(yes) & prss n(no)\n";

if (c == 'y')

Family.writer("Familycontact");
47 | P a g e
c Project Title

cout << "Exiting program!\n";

decision = 'n';

break;

default:

cout << "Wronge Input!\n";

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

else

if (selection == 2)

Friend.reader("Friendscontact");

cout << "Press 1 to insert:\n";

cout << "Press 2 to delete by name:\n";

cout << "Press 3 to delete by number:\n";

cout << "Press 4 to search by name:\n";

cout << "Press 5 to search by number:\n";

cout << "press 6 to edit :\n";

cout << "Press 7 to display:\n";

48 | P a g e
c Project Title

cout << "Press 8 to exit:\n";

cin >> choice;

system("cls");

switch (choice)

case 1:

cout << "Enter name:\n";

cin >> name;

cout << "Enter number:\n";

cin >> number;

Friend.insertSorted(name, number);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 2:

cout << "Enter name:\n";

cin >> name;

Friend.deletionbyname(name);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

49 | P a g e
c Project Title

case 3:

cout << "Enter number:\n";

cin >> number;

Friend.deletionbynumber(number);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 4:

cout << "Enter name:\n";

cin >> name;

Friend.searchbyname(name);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 5:

cout << "Enter number:\n";

cin >> number;

Friend.searchbynumber(number);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 6:
50 | P a g e
c Project Title

cout << "Enter name:\n";

cin >> name;

Friend.Edit(name);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 7:

Friend.display();

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 8:

char c;

cout << "Do you want to save?Press y(yes) & prss n(no)\n";

if (c == 'y')

Friend.writer("Friendscontact");

cout << "Exiting program!\n";

decision = 'n';

break;

default:

51 | P a g e
c Project Title

cout << "Wronge Input!\n";

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

else

if (selection == 3)

work.reader("Workcontact");

cout << "Press 1 to insert:\n";

cout << "Press 2 to delete by name:\n";

cout << "Press 3 to delete by number:\n";

cout << "Press 4 to search by name:\n";

cout << "Press 5 to search by number:\n";

cout << "press 6 to edit :\n";

cout << "Press 7 to display:\n";

cout << "Press 8 to exit:\n";

cin >> choice;

system("cls");

52 | P a g e
c Project Title

switch (choice)

case 1:

cout << "Enter name:\n";

cin >> name;

cout << "Enter number:\n";

cin >> number;

work.insertSorted(name, number);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 2:

cout << "Enter name:\n";

cin >> name;

work.deletionbyname(name);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 3:

cout << "Enter number:\n";

cin >> number;

work.deletionbynumber(number);

53 | P a g e
c Project Title

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 4:

cout << "Enter name:\n";

cin >> name;

work.searchbyname(name);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 5:

cout << "Enter number:\n";

cin >> number;

work.searchbynumber(number);

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 6:

cout << "Enter name:\n";

cin >> name;

work.Edit(name);

54 | P a g e
c Project Title

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 7:

work.display();

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

break;

case 8:

char c;

cout << "Do you want to save?Press y(yes) & prss n(no)\n";

if (c == 'y')

work.writer("Workcontact");

cout << "Exiting program!\n";

decision = 'n';

break;

default:

55 | P a g e
c Project Title

cout << "Wronge Input!\n";

cout << "If you want to go on the main menu press y(yes):\nIf you want to Exit the
process press n(no):\n";

cin >> decision;

else

if (selection == 4)

decision = 'n';

cout << "Exiting program!\n";

else

cout << "Wronge Input!\n";

} while (decision != 'n');

56 | P a g e

You might also like