#include <iostream>
#include <vector>
#include <string>
using namespace std;
class Contact {
private:
string name;
string phone;
string email;
public:
Contact(string n, string p, string e) {
name = n;
phone = p;
email = e;
string getName() {
return name;
void display() {
cout << "Name: " << name << endl;
cout << "Phone: " << phone << endl;
cout << "Email: " << email << endl;
};
class ContactManager {
private:
vector<Contact> contacts;
public:
void addContact(string name, string phone, string email) {
contacts.push_back(Contact(name, phone, email));
void displayAll() {
for (auto& c : contacts) {
[Link]();
cout << "------------------" << endl;
void searchContact(string name) {
bool found = false;
for (auto& c : contacts) {
if ([Link]() == name) {
[Link]();
found = true;
break;
if (!found) {
cout << "Contact not found." << endl;
}
};
int main() {
ContactManager cm;
int choice;
string name, phone, email;
do {
cout << "1. Add Contact\n2. Display All\n3. Search Contact\n4. Exit\nChoice: ";
cin >> choice;
[Link]();
if (choice == 1) {
cout << "Enter Name: ";
getline(cin, name);
cout << "Enter Phone: ";
getline(cin, phone);
cout << "Enter Email: ";
getline(cin, email);
[Link](name, phone, email);
} else if (choice == 2) {
[Link]();
} else if (choice == 3) {
cout << "Enter Name to Search: ";
getline(cin, name);
[Link](name);
} while (choice != 4);
return 0;