In this blog post, you will learn to do a programming project of C++ by making a phonebook project in C++.
Simply copy and paste this code in codeblocks/codelite or what ever you are using.
This project is about a phonebook where you can add contact, view them by their name and id.
Removing or editing contact feature is not available in this version, but if you can understand this program; then you can simply add the code that can help to edit or remove contacts.
You will not find simple code than this for your programming project. Now after completing this, you can try other programs also.
/*record the phone number of a person*/
//vector will be used so that vector library will be used
using namespace std;
//the program will have 3 sections to add a contact, search for a contact using ID, and search for contact using name
while(true) /*infinite loop used here*/
cout<<"choose a number to execute a option\n";
cout<<"Search by ID\n";
cout<<"Search by Name\n";
cout<<"enter your contact's name and phone\n";
cout<<"the id for this contact will be\n"<<name<<endl<<phone;
cout<<"enter your contact's id that you need to search";
cout<<"this id does not exist\n";
return; /*return is used here to terminate the function*/
cout<<"information for contact\n";
cout<<"Name"<<Names[value]<<endl; /* index is this and this is used to differentiate the values within the vector*/
bool found=false; /*bool is a data type that is only true or false, it will tell us if the search was either successful or failed*/
cout<<"enter the name to search\n";