Professional Documents
Culture Documents
Telephone Directory
Telephone Directory
Of
FOUNDATION OF COMPUTING
Topic: - TELEPHONE DIRECTORY
REGD. NO:-
10801374
1
ACKNOWLEDGEMENT
It is not until you undertake the project like this one that you realize
how massive the effort it really is, or how much you must rely upon
the Selfless efforts and goodwill of others. There are many who
helped us with this project, and we want to thank them all from the
core of our Hearts.
And last but not the least, we find no words to acknowledge the
financial assistance & moral support rendered by our parents in
making the effort a success. All this has become reality because of
their blessings and above all by the grace of god.
ASHUTOSH KUMAR
ROLL NO:-R246B47
REGD.ID:-10801374
2
TABLE OF CONTENTS
INTRODUCTION:
3
We have discussed so far various features of C language and are
ready to write and execute program of modest complexity. However,
before attempting to develop complex programs, it is worthwhile to
consider some programming techniques that would help design
efficient and error free.
OVERVIEW TO C
HISTORY OF C:
4
C is a popular general purpose programming language. It is one
of the most popular computer languages today, because it is a
structured, high level, machine independent language.
IMPORTANCE OF C:
5
The increasing popularity of C is probably due to its many
desirable qualities. The C compiler combines the capabilities of an
assembly language with the features of a high level language and
therefore it is well suited for writing both system software and
business packages. In fact many of the C compilers available in the
market are written in C. Programs written in C are efficient and fast.
This is due to its variety of data types and powerful operators. It is
many times faster than BASIC.
There are only 32 key words in ANSI C and its strength lies in its
built in functions. C is highly portable; this means that C programs
written for one computer can be run on another with little or no
modifications. C language is well suited for structured programming,
thus requiring the user to think of a problem in terms of function
modules or blocks. This modular structure makes program de-
bugging, testing and maintenance easier.Another important feature of
C is its ability to extend itself. We can continuously add our own
functions to C library, thus our programming task becomes so easier
and simple.
Introduction of TELEPHONE
DIRECTORY
6
We can make this TELEPHONE DIRECTORY in C language by using three
or more than three header files or many data types such as:
there are many header files which are used in this program….
many more…..
such as 1.Strrev();
2. Strlen();
3. Strupr();
4. Strlwr();
SYSTEM REQUIREMENTS
7
Operating System: Windows 2000/NT/Xp/Vista
Processor P3 or High
SYSTEM DESCRIPTION
system design:
START
WELCOME TO THE
MAIN MENU
IF U WANT 9
ENTER
TO YOUR
NEW
DISPLAY AN
DELETE AN DISPLAY CHOICE
EMPTY SAVE LOADDELETE STO
END
ENTRY
CONTINUE ALL FILES
ENTRY ALL THE ENTRIES
IF YES
IF NO
SOURCE CODE
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<alloc.h>
#include<string.h>
#include<graphics.h>
10
struct entry
char name[50];
char nick[50];
char email[50];
char address[50];
char city[50];
char cont[50];
char pin[50];
}*temp,*newe,*l,*r;
void newentry();
void displayall();
void makempty();
int isempty();
void saventry();
void loadentry();
void deleteall();
void newentry()
11
char a[50],b[50],f[50],g[50],c[50],d[50],e[50];
int i,k=0;
printf("Name :");
scanf("%s",a);
scanf("%s",b);
printf("E-mail ID :");
scanf("%s",c);
printf("Address :");
scanf("%s",d);
printf("City :");
scanf("%s",e);
printf("Contact No:");
scanf("%s",f);
printf("Pincode :");
scanf("%s",g);
for(i=0;i<50;i++)
newe->name[i]=' ';
newe->nick[i]=' ';
newe->email[i]=' ';
newe->address[i]=' ';
12
newe->city[i]=' ';
newe->cont[i]=' ';
newe->pin[i]=' ';
for(i=0;i<50;i++)
newe->name[i]=a[i];
newe->nick[i]=b[i];
newe->email[i]=c[i];
newe->address[i]=d[i];
newe->city[i]=e[i];
newe->cont[i]=f[i];
newe->pin[i]=g[i];
if(isempty())
newe->lptr=newe->rptr=NULL;
l=r=newe;
else
temp=l;
while(temp!=NULL)
13
{
i=stricmp(newe->name,temp->name);
if(i<0)
break;
else if(i>0)
temp=temp->rptr;
else if(i==0)
k=1;
break;
if(k!=1)
if(temp==l)
newe->lptr=NULL;
newe->rptr=l;
l->lptr=newe;
l=newe;
else if(temp==NULL)
14
{
newe->rptr=NULL;
newe->lptr=r;
r->rptr=newe;
r=newe;
else
newe->rptr=temp;
newe->lptr=temp->lptr;
temp->lptr=newe;
(newe->lptr)->rptr=newe;
void displayall()
{ int n=1;
if(!isempty())
temp=l;
15
while(temp!=NULL)
temp=temp->rptr;
n++;
else
int i;
if(isempty())
else{
temp=l;
while(temp!=NULL)
i=stricmp(temp->name,n);
if(i==NULL)
16
{
if(l==r)
l=r=NULL;
printf("Entry deleted");
break;
else if(temp==l)
l=l->rptr;
l->lptr=NULL;
printf("Entry deleted");
break;
else if(temp==r)
r=r->lptr;
r->rptr=NULL;
printf("Entry deleted");
break;
else{
(temp->lptr)->rptr=temp->rptr;
(temp->rptr)->lptr=temp->lptr;
17
printf("Entry deleted");
break;
temp=temp->rptr;
if(temp==NULL)
printf("Not Found");
int isempty()
return l==NULL;
void makempty()
l=r=NULL;
18
void display(char n[50])
int i,p=1;
if(isempty())
else
temp=l;
while(temp!=NULL)
i=stricmp(temp->name,n);
if(i==NULL)
{if(p==1)
else if(p==2)
else if (p==3)
else
19
",temp->name,temp->nick,temp->email,temp->address,temp-
>city,temp->cont,temp->pin);
break;
temp=temp->rptr;
p++;
if(temp==NULL)
void main()
int l=1,m;
int gd=DETECT,gm;
char n[50];
initgraph(&gd,&gm,"c:\tc\bgi");
while(l!=8)
clrscr();
textmode(C80);
textcolor(4);
20
cprintf("********************************************************
************************#------------------------MINI PROJECT-
TELEPHONE DIRECTORY
--------------------#************************************************
********************************");
printf(" ");
cprintf("(1)-New Entry");
printf(" ");
cprintf("(2)-Display an Entry");
printf(" ");
cprintf("(3)-Delete an Entry");
printf(" ");
printf(" ");
printf(" ");
cprintf("(6)-Save Entry");
printf(" ");
cprintf("(7)-Load Entries");
printf(" ");
printf(" ");
cprintf("(9)-End");
printf(" ");
21
cprintf("********************************************************
************************");
printf(" ");
scanf("%d",&l);
switch(l)
case 1:
textcolor(2);
newentry();
getch();
break;
case 2:
textcolor(2);
printf(" ");
scanf("%s",&n);
display(n);
getch();
break;
case 3:
textcolor(2);
printf(" ");
scanf("%s",&n);
22
deletentry(n);
getch();
break;
case 4:
textcolor(2);
displayall();
getch();
break;
case 5:
textcolor(2);
makempty();
getch();
break;
case 6:
textcolor(2);
saventry();
getch();
break;
case 7:
textcolor(2);
loadentry();
getch();
break;
case 8:
23
textcolor(2);
deleteall();
getch();
break;
case 9:
textcolor(2);
printf(" ");
getch();
break;
default:
textcolor(2);
printf(" ");
getch();
break;
getch();
void saventry()
char n[50];
int c;
24
list t;
int i;t=l;
scanf("%s",n);
if(isempty())
else
FILE *f;
f=fopen("entry.c","a");
while(t!=NULL)
i=stricmp(t->name,n);
if(i==0)
fprintf(f,"%s %s %s %s %s %s %s",t->name,t->nick,t->email,t-
>address,t->city,t->cont,t->pin);
scanf("%d",&c);
if(c==1)
saventry();
else if(c==2)
break;
25
}
t=t->rptr;
fclose(f);
if(t==NULL)
void loadentry()
int i=1;
list t;
FILE *f;
f=fopen("entry.c","r");
if(f==NULL)
printf("Cannot Open");
exit(1);
while(fscanf(f," %s %s %s %s %s %s %s",t->name,t-
>nick,t->email,t->address,t->city,t->cont,t->pin)!=EOF)
26
i++;}
fclose(f);
void deleteall()
FILE *f;
f=fopen("entry.c","w");
fclose(f);
27
OUTPUT
28
29
30
TESTING
2-INTEGRATION TESTING
31
FUTURE SCOPE
In future one change can be done by adding the fingerprints of the
persons of which the address is entered.And one more major change
which can be done in this project is that to add the snaps of the person
of which the address is entered.We can also add or subtract details of
the individual.
32