OOP Mini Project_034440
OOP Mini Project_034440
Submitted by
Om Shinde (SB58)
AY 2024-2025
Semester-1
TABLE OF CONTENTS
(Page Number)
1. PROBLEM STATEMENT 2
2. INTRODUCTION 3
4. REQUIREMENTS 4
5. RESULT 7
6. CONCLUSION 10
7. REFERENCES 10
Write a menu driven program that will create a data file containing the list of
telephone numbers in the following form
John 23456
Ahmed 9876
........... .........
• Use a class object to store each set of data, access the file created and implement
the following tasks
• Determine the telephone number of specified person
• Determine the name if telephone number is known
• Update the telephone number, whenever there is a change.
2 INTRODUCTION
This system is a simple, menu-driven program developed in Python, aimed at managing a list of
telephone numbers. It utilizes a class structure to store contact information and stores this data in
a file for persistent access.
With these capabilities, the system is a useful tool for keeping and updating contact information,
making it ideal for small-scale use cases where contacts need to be stored and retrieved easily.
ALGORITHM:
- Print the `number`, set `found` to `true`, and break the loop.
- If `found` remains `false`, print "Name not found."
- Close the file.
- Set `found` to `true` (do not copy the entry to the temporary file).
- Otherwise, write the `name` and `number` to the temporary file.
- Close both files.
- Replace the original file with the temporary file.
- If `found` is `true`, print "Number deleted successfully"; otherwise, print "Name not found."
- Write the `name` and `newNumber` to the temporary file, set `found` to `true`.
- Otherwise, write the original `name` and `number` to the temporary file.
4 REQUIREMENTS
Menu:
1. Add Entry
2. Find Number by Name
3. Find Name by Number
4. Update Number
5. Display All Entries
6. Delete Number
7. Exit
Enter your choice: 1
Enter name: A
Enter telephone number: 123
Menu:
1. Add Entry
2. Find Number by Name
3. Find Name by Number
4. Update Number
5. Display All Entries
6. Delete Number
7. Exit
Enter your choice: 1
Enter name: B
Enter telephone number: 456
Menu:
1. Add Entry
2. Find Number by Name
3. Find Name by Number
4. Update Number
5. Display All Entries
6. Delete Number
7. Exit
Enter your choice: 5
A: 123
B: 456
Menu:
1. Add Entry
2. Find Number by Name
3. Find Name by Number
4. Update Number
5. Display All Entries
6. Delete Number
7. Exit
Menu:
1. Add Entry
2. Find Number by Name
3. Find Name by Number
4. Update Number
5. Display All Entries
6. Delete Number
7. Exit
Enter your choice: 5
A: 123
B: 789
Menu:
1. Add Entry
2. Find Number by Name
3. Find Name by Number
4. Update Number
5. Display All Entries
6. Delete Number
7. Exit
Enter your choice: 6
Enter Name to Delete: A
Number deleted successfully
Menu:
1. Add Entry
2. Find Number by Name
3. Find Name by Number
4. Update Number
5. Display All Entries
6. Delete Number
7. Exit
Enter your choice: 5
B: 789
Menu:
1. Add Entry
2. Find Number by Name
3. Find Name by Number
4. Update Number
5. Display All Entries
Menu:
1. Add Entry
2. Find Number by Name
3. Find Name by Number
4. Update Number
5. Display All Entries
6. Delete Number
7. Exit
Enter your choice: 7
Exiting...
6 CONCLUSION
This C++ program implements a simple telephone directory system that allows users to add,
search, update, display, and delete entries in a text file. It provides a basic menu-driven interface
for interacting with the directory. File handling is used for storing and modifying data, while
basic error handling ensures the program runs smoothly. While functional, the program could be
improved with input validation, case-insensitive searches, and a more structured data format for
scalability. Overall, it's an effective, lightweight solution for managing a small set of telephone
entries.
7 REFERENCES
o GeeksforGeeks - C++ Data Structures
o cppreference: File Input/Output