Program of Telephone Directory - C++ Programming Tutorial - Codepoc - Io
Program of Telephone Directory - C++ Programming Tutorial - Codepoc - Io
io
https://www.codepoc.io/blog/cpp/2620/program-of-telephone-directory 1/5
3/21/2020 Program of telephone directory - C++ Programming Tutorial | Codepoc.io
//Telephone Directory
#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <iomanip.h>
#include <conio.h>
class phoneBook{
char name[20],phno[15];
public:
void getdata();
void showdata();
char *getname(){ return name; }
char *getphno(){ return phno; }
void update(char *nm,char *telno){
strcpy(name,nm);
strcpy(phno,telno);
}
};
void main(){
phoneBook rec;
fstream file;
file.open(\"d:\\\\phone.dat\", ios::ate | ios::in | ios::out | ios::binary);
char ch,nm[20],telno[6];
int choice,found=0;
while(1){
clrscr();
cout<<\"\\n*****Phone Book*****\\n\";
cout<<\"1) Add New Record\\n\";
cout<<\"2) Display All Records\\n\";
cout<<\"3) Search Telephone No.\\n\";
cout<<\"4) Search Person Name\\n\";
cout<<\"5) Update Telephone No.\\n\";
cout<<\"6) Exit\\n\";
cout<<\"Choose your choice : \";
cin>>choice;
switch(choice){
case 1 : //New Record
rec.getdata();
cin.get(ch);
file.write((char *) &rec, sizeof(rec));
break;
{
found=1;
rec.showdata();
}
}
file.clear();
if(found==0)
cout<<\"\\n\\n---Record Not found---\\n\";
getch();
break;
Related Post:
Program to show the projection of 3D objects using Orthographics Projection
Parallel onto xy-plane
https://www.codepoc.io/blog/cpp/2620/program-of-telephone-directory 3/5
3/21/2020 Program of telephone directory - C++ Programming Tutorial | Codepoc.io
Program of parser 2
Program that performs SCANNING of the following program and finds the
entire float,integer variables and keywords present in the program
Program that reads two numbers from user, computes and display their sum.
Program that uses this DFA and validates whether an entered string is valid
integer or not.
Program to estimate the value of Third Derivative of the function at the given
points from the given data using Central Difference Formula of Order 4
Program that reads a number and displays it with its digits in reverse order
using do-while loop
Program to estimate the value of First Derivative of the function at the given
points from the given data using Central Difference Formula
Program to print, read and calculate sum, smallest, largest element an array
using pointers
Program to illustrate the use of pointer this using header file this.h
Program to fill different types of geometric shapes using Flood Fill Algorithm
(Using Linked-List)
https://www.codepoc.io/blog/cpp/2620/program-of-telephone-directory 4/5
3/21/2020 Program of telephone directory - C++ Programming Tutorial | Codepoc.io
Didn't find what you were looking for? Find more on Program of telephone directory
Contact Us | Blogs
https://www.codepoc.io/blog/cpp/2620/program-of-telephone-directory 5/5