SlideShare a Scribd company logo
7
Most read
11
Most read
22
Most read
1
PROJECT TITLE: PhonebookApplication
Adding new records into the memory, listing them, modifying them and updating, search for
contacts saved, and deleting the phonebook contacts are the basic functions which make up the main
menu of this Phonebook application (as shown in the main menu screenshot below).
Personal information such as Name, gender, Father’s name, Mother’s name,
phone number, email and address are asked while adding a record into the Phonebook. After the
initial addition of the contacts these records are then be modified, listed, searched for and removed if
they are requires a change.
The program uses many functions in. These functions are easy to understand as their name only
signifies their respective operations. These functions make the program to divide into individual
modules and hence it makes the program simpler to understand.
void menu () – This function is used to display the main menu.
void start () – This functions calls the menu function mentioned above.
void back () – This function is used to go back to start.
void addrecord () – It adds a new Phonebook record.
void listrecord () – This function is used to view list of added records in file.
void modifyrecord () – This function is used to modify added records.
void deleterecord () – It deletes record from file.
void searchrecord () – It searches for added record by name.
DONE BY:
S.V.Rohith-150031000
2
ABSTRACT
The Title of the Program is to develop a program which deals with the combination of
structures, arrays, File pointers and other functions. This program could do some operations on
arrays such as insertion, deletion, sorting, searching, update, retrieve, merging, append, exit.
By implementing this program we can execute the inserted contact data, deletion of
the data, searching, updating, append, exit with numbers by using arrays and file pointers. This
program is implemented for only numbers that can enter into an array. To do this analysis manually
it takes a lot of time and patience but by implementing this program using a high level language like
C it becomes much easier. But before going to make final solution for the problem, the problem must
be analysed.
First of all the basic information regarding the program which consists of complex
numbers. This program is solved by using several methods like one can solve this program using
user defined functions concept, loops conditions, go to statements. In this abstract we used the
concept of functions, while loop, for loop, switch case and if condition’s which helps to execute the
problem much easier .The following steps are followed while implementing the given program using
if and while loop.
 The input is entered i.e., the value of choice (the menu no) select the particular menu.
 Next it goes to particular menu and then go to the particular function.
 It prints the resultant value which came from the execution.
The outcome of the work is one can get the required changes like inserting or deleting or
sorting or merging or append or retrieve or update or exit for a given array.
3
INDEX
S.NO TITLE PAGE NO
1. Introduction 6
2. Aim of the Project 8
2.1 Advantages & Disadvantages
2.2 Future Implementation
3. Software & Hardware Details 8
4. Data Flow Diagram 9
5. Algorithm 13
6. Implementation 24
4
INTRODUCTION
C is a structured, high level machine
independent language. C is converted to a lower language which was understood by the compiler. It
allows the software developers to develop programs without worrying about the hardware plat forms
where there will be implemented. The c language comes from the ALGOL which gives the concept
structured programming to the computer science community. It was introduced early in 1960’s.
After, MARTIN RICHARDS DEVELOPED a language known as BCPL in 1967 for this in 1970’s
ken Thompson created a language from BCPL and he called as “B” both BCPL and B are types less
system programming languages. After finding ALGOL BCPL, AND B then from this c is evolved
from that at BELL LABORATORIES in 1972 by “DENIS RITCHE”. C language uses many
concepts from these and added the concept of data type because it was developed along with a UNIX
operating system. UNIX is nothing but a most popular network operating system is used today and
the heart of the internet data super high way. C-language is robust language because c-supports
richest of operators and burden functions this consist of many operators, operands, key words,
special characters, many characters.
Features of c-programming:-
 It is a structural programming language with fundamental flow control construction.
 It is highly portable. The program written on one computer can run on another computer also
without any modification or with a slight modification.
 It contains 32 keywords.
 It is simple and versatile programming language.
 It is richest than all programs.
 Dynamic memory allocation is possible in ‘c’.
Structures
We have seen that arrays can be used to represent a group of data items that belongs to
same data type. If we want to represent a collection of data items of different data types using
a single name, then we cannot use an array. C supports a constructed data type known as
Structure, which is a method for packing data of different data types. A structure is a
convenient tool for handling a group of logically related data items. Structures help to
organize complex data in a more meaningful way. It is a powerful concept that we may often
need to Use in our program design.
Definition:
5
A group of data items that belongs to different data types is known as Structure.
‘Struct’ : It is a keyword and is used to declare a Structure.
Declaration of structure:
struct struct_name
{
Data item-1;
Data item-2;
…………
…………
Data item-n;
};
Declaration of structure variable:
struct struct_name identifier;
(or)
struct struct_name dentifier-1,identifier-2,.......,identifier-n;
(Access operator):
It is used to access the data items of a structure with the help of structure variable.
Syntax:
struct_variable . Data item;
6
AIM:
• To develop a “Phonebook contact” application using c programming.
• This program is very useful now-a-days to store complete information under single contact
number.
• This program also has options to deletion and modification of the entered contact number.
Advantages:
• It becomes easy for the user to store complete information (e-mail id, address, e.t.c) about his
contact.
• It is easy for the user to just search his required contact number by just typing name of the
contact.
Disadvantages:
• Sometimes it becomes difficult to store more contacts (over 150).
Future Enhancements:-
 It becomes even difficult to store contacts with two or more contact numbers
SOFTWARE REQUIREMENTS:
• This application is developed in Microsoft windows xp or later operating system.
• This Phonebook application is coded and made using the following compilers:
1. Code::blocks.
2. Turbo c.
HARDWARE REQUIREMENTS:
• This Application size is 33Kb and the size of the code is 5Kb so such amount of memory is
required from hard disk.
• RAM: minimum 256MB.
• Mouse, keyboard.
7
DATA FLOW DIAGRAM:
Read menu no
Case 3:
Case 6:
n
Module 6
Case 1:Module 1
Start
Menu for Phonebook Application
1
Case 2:Module 2
Case 4:
Module 5 Case 5:
Module 4
Module 3
8
Default:
Enter 1 to 6
only
Module 2
Read Name,Address,Father
Name,Mother Name,Phone
number,Sex
Print Record saved
Read menu no
Stop
Module 1
Print All the contacts in the Phonebook
Read menu no
9
Module 3
Print Your data modified
Read the modified details
Name,Address,Father Name,Mother Name,Phonenumber,Sex
Read menu no
Read the name entered to modify
Print all the details of the
searched contact
Module 4
Read the name to be searched
Read menu no
10
Module 5
Read menu no
Read the name of the contact
to be deleted
Print Record deleted successfully
11
ALGORITHM:
1. Start.
2. Display the options on the screen.
3. Read name, address, father name, mother name, mobile number, gender.
4. Print “WELCOME TO PHONEBOOK” and “Menu” on the screen
a. Add contact
b. Print all contacts
c. Modify contacts
d. Search contact
e. Delete contact
f. Close phone book
5. Now for Addrecord (),arranging data as Enter name, Enter address, Enter father
name, Enter mother name, Enter phone book no, Enter Gender and finally
operations recordsaved , Enter any key.
6. Now for listrecord(), arranging data as
a. if data is empty print file opening error in listing
b. Else print your record: name, address, father, mother, mobile no,
Gender.
c. After all these print enter any key
7. Now for searchrecord(), arranging data as
a. if data is insufficient print error in opening
b. Else
c. print enter name of contact to be searched and
i. If (strcmp(p.name,name)==0)
ii. print detail information about name and name, address, father
name, mother name, mobile num, gender.
d. After entering all these, print enter any key
8. Now for deleterecord(), arranging the data as
a. If (f==null)
b. print contact’s data not added yet
i. else
ii. if(f==null)
iii. print file opening error
iv. Else
v. Print enter contact’s details.
9. if (flag!=1)
12
a. print no contact’s recordto delete
b. Else
c. print record deleted successfully
d. After entering all the data print enter any key
10.for modifyrecord(),arranging the data as
a. If (f==null)
b. print contact’s data not added yet
c. Else
d. enter contact’s name to modify
i. Print enter name , enter address , enter father name, enter mother
name,mobile number, sex after entering the data
ii. print your data is modified
iii. Else
iv. print data is not found
v. Finally print enter any key.
11.Redisplay the menu for user required input.
13
Code of the application:
#include<conio.h>
#include<string.h>
#include<stdio.h>
struct contact
{
char nam[50];
char adres[50];
long int m_no;
char gender[10];
char m_id[100];
};
void Menu();
void Data();
void ARec();
void ListRec();
void ModRec();
void DelRec();
void SRec();
int exit();
int main()
{
Menu();
return 0;
}
void Menu()
14
{
printf("tt WELCOME TO PHONEBOOK");
printf("nntt MENU tnn");
printf("t1.List Contactst2.Add New Contactt3.Modify n");
printf("t4.Searcht5.Deletet6.Exitn");
switch(getch())
{
case '1': ListRec();
break;
case '2': ARec();
break;
case '3': ModRec();
break;
case '4': SRec();
break;
case '5': DelRec();
break;
case '6': exit();
break;
default: printf("n Enter 1 to 6 only.");
getch();
}
}
int exit()
{
Menu();
return 0;
15
}
void ARec()
{
FILE *f;
struct contact p;
f=fopen("project","ab+");
printf("n Name: ");
Data(p.nam);
printf("nAddress: ");
Data(p.adres);
printf("nMobile no.:");
scanf("%ld",&p.m_no);
printf("Gender:");
Data(p.gender);
printf("ne-mail:");
Data(p.m_id);
fwrite(&p,sizeof(p),1,f);
fflush(stdin);
printf("nrecord saved");
fclose(f);
getch();
Menu();
}
void ListRec()
{
struct contact p;
FILE *f;
16
f=fopen("project","rb");
if(f==NULL)
{
printf("n No contacts detected yet!:n");
exit();
}
while(fread(&p,sizeof(p),1,f)==1)
{
printf("nnn YOUR RECORD ISnn ");
printf("nName=%snAdress=%snMobile no=%ldngender=%snE-
mail=%s",p.nam,p.adres,p.m_no,p.gender,p.m_id);
getch();
}
fclose(f);
getch();
Menu();
}
void SRec()
{
struct contact p;
FILE *f;
char name[100];
f=fopen("project","rb");
if(f==NULL)
{
printf("n Error in openingn");
17
exit();
}
printf("nEnter name of person to searchn");
Data(name);
while(fread(&p,sizeof(p),1,f)==1)
{
if(strcmp(p.nam,name)==0)
{
printf("ntDetail Information About %s",name);
printf("nName:%snaddress:%snMobile no:%ldngender:%snE-
mail:%s",p.nam,p.adres,p.m_no,p.gender,p.m_id);
}
else
printf("Not found");
}
fclose(f);
getch();
Menu();
}
void DelRec()
{
struct contact p;
FILE *f,*ft;
int flag;
char name[100];
f=fopen("project","rb");
18
if(f==NULL)
printf("Contact data not yet added.");
else
{
ft=fopen("temp","wb+");
if(ft==NULL)
printf("file opening error");
else
{
printf("Enter contact name:");
Data(name);
fflush(stdin);
while(fread(&p,sizeof(p),1,f)==1)
{
if(strcmp(p.nam,name)!=0)
fwrite(&p,sizeof(p),1,ft);
if(strcmp(p.nam,name)==0)
flag=1;
}
fclose(f);
fclose(ft);
if(flag!=1)
{
printf("No Record To Delete.");
remove("temp.txt");
}
else
19
{
remove("project");
rename("temp.txt","project");
printf("Record Deleted");
}
}
}
getch();
Menu();
}
void ModRec()
{
int c;
FILE *f;
int flag=0;
struct contact p,s;
char nam[50];
f=fopen("project","rb+");
if(f==NULL)
{
printf("No Contact added yet!n");
exit();
}
else
{
20
printf("Enter Name to modify:n");
Data(nam);
while(fread(&p,sizeof(p),1,f)==1)
{
if(strcmp(nam,p.nam)==0)
{
printf("nName:");
Data(s.nam);
printf("nAddress:");
Data(s.adres);
printf("nPhone no:");
scanf("%ld",&s.m_no);
printf("nGender:");
Data(s.gender);
printf("ne-mail:");
Data(s.m_id);
fseek(f,-sizeof(p),SEEK_CUR);
fwrite(&s,sizeof(p),1,f);
flag=1;
break;
}
fflush(stdin);
}
if(flag==1)
21
printf("n Your contact is modified");
else
printf(" n Contact data not found");
fclose(f);
}
getch();
Menu();
}
void Data(char *Name)
{
int i=0,j;
char ch,cha;
do
{
ch=getch();
if(ch!=8&&ch!=13)
{
*(Name+i)=ch;
putch(ch);
i++;
}
if(ch==8)
{
if(i>0)
{
i--;
22
}
for(j=0;j<i;j++)
{
cha=*(Name+j);
putch(cha);
}
}
}while(ch!=13);
*(Name+i)='0';
}
Conclusion:
This program makes the user simpler to connect to his contact. The contact personal information and
family information is stored under a single number this would benefit the user to easily search and
locate his required contact. This program deals with four operations of adding contacts, deleting
them, modifying, searching according the user’s choice. Each operation is made as an individual
function and so control enters to different structures and all the data added or modified or deleted is
going to be stored in a .txt file using FILE pointers.

More Related Content

PPTX
A c program of Phonebook application
PPTX
Phone Book project in Data Structure C
DOCX
COLLEGE PHONE BOOK Final documentation
PPTX
Phonebook project in C
DOC
Telephone directory in c
PDF
Telephone directory using c language
DOC
Telephone directory
DOC
Telephone billing system in c++
A c program of Phonebook application
Phone Book project in Data Structure C
COLLEGE PHONE BOOK Final documentation
Phonebook project in C
Telephone directory in c
Telephone directory using c language
Telephone directory
Telephone billing system in c++

What's hot (20)

PPT
Data structures using c
PDF
Project presentation on Phone Book
PPT
File handling in c
PPT
Binary Search
PPTX
CSE Final Year Project Presentation on Android Application
DOCX
Food donation project report II
PPTX
memory reference instruction
PPTX
8 queens problem using back tracking
DOCX
Banking Management System Project documentation
PPTX
C tokens
PPTX
Linked list
PPTX
Direct linking loaders
PPT
Bubble sort
PPTX
Binary Search Tree in Data Structure
PPTX
class and objects
PPTX
Programming Fundamentals lecture 1
PPT
Variables in C Programming
PDF
List,tuple,dictionary
PPTX
structured programming
PPTX
Presentation on-exception-handling
Data structures using c
Project presentation on Phone Book
File handling in c
Binary Search
CSE Final Year Project Presentation on Android Application
Food donation project report II
memory reference instruction
8 queens problem using back tracking
Banking Management System Project documentation
C tokens
Linked list
Direct linking loaders
Bubble sort
Binary Search Tree in Data Structure
class and objects
Programming Fundamentals lecture 1
Variables in C Programming
List,tuple,dictionary
structured programming
Presentation on-exception-handling
Ad

Viewers also liked (12)

PPTX
telephone directory
PDF
Phonebook Directory or Address Book In Android
PPS
Phonebook
TXT
Phonebook
PDF
University Management Information System
PPT
University Management System
DOC
Introduction and objectives of the project
PPTX
Hotel Management System
PPTX
Library Management System PPT
PDF
Project Proposal document for Hotel Management System
DOCX
Library Management System
PDF
Library mangement system project srs documentation.doc
telephone directory
Phonebook Directory or Address Book In Android
Phonebook
Phonebook
University Management Information System
University Management System
Introduction and objectives of the project
Hotel Management System
Library Management System PPT
Project Proposal document for Hotel Management System
Library Management System
Library mangement system project srs documentation.doc
Ad

Similar to A c program of Phonebook application (20)

PPTX
Cse project-1
ODT
Bangladesh university of business and technology
PPTX
ds ppt.pptx ppt on phone book application in java
PPTX
ds ppt.pptxnanu minchi edigetodu inkodu unnadu chdu evarante adi repati nene ...
PPTX
ds ppt.pptxnanu minchi edigetodu inkodu unnadu chdu evarante adi repati nene ...
DOCX
Phonebookapplic.docxnanu minchi edigetodu inkodu unnadu chdu evarante adi rep...
PDF
cminiproject-151115084708-lva1-app6892.pdf
DOC
Student record
DOCX
Let's us c language (sabeel Bugti)
PPTX
Team-7 SP.pptxdfghjksdfgduytredfghjkjhgffghj
DOCX
C s investigatory project on telephone directory
PDF
A Project Based Lab Report On AMUZING JOKE
PPTX
3rd semester 4gsbshagscv.akshathamahsbpptx
PDF
phonebook-170502105942 (1).pdf
DOC
Ums in c
DOC
Project report
PDF
Contact management system
DOC
Notes of c programming 1st unit BCA I SEM
PDF
Book management system
PPTX
venkatesh.pptx
Cse project-1
Bangladesh university of business and technology
ds ppt.pptx ppt on phone book application in java
ds ppt.pptxnanu minchi edigetodu inkodu unnadu chdu evarante adi repati nene ...
ds ppt.pptxnanu minchi edigetodu inkodu unnadu chdu evarante adi repati nene ...
Phonebookapplic.docxnanu minchi edigetodu inkodu unnadu chdu evarante adi rep...
cminiproject-151115084708-lva1-app6892.pdf
Student record
Let's us c language (sabeel Bugti)
Team-7 SP.pptxdfghjksdfgduytredfghjkjhgffghj
C s investigatory project on telephone directory
A Project Based Lab Report On AMUZING JOKE
3rd semester 4gsbshagscv.akshathamahsbpptx
phonebook-170502105942 (1).pdf
Ums in c
Project report
Contact management system
Notes of c programming 1st unit BCA I SEM
Book management system
venkatesh.pptx

More from svrohith 9 (14)

DOCX
Simple Blockchain Eco System for medical data management
PDF
A mini project on designing a DATABASE for Library management system using mySQL
DOCX
A Computers Architecture project on Barrel shifters
DOCX
A JAVA project on Marriage bureau management system
DOCX
A Measurements Project on Light Detection sensor
DOCX
A Software Engineering Project on Cyber cafe management
DOC
A project on Ecology case studies
DOCX
A project on advanced C language
PDF
A MATLAB project on LCR circuits
PDF
10_CERITIFICATE
PPT
Pedal power hacksaw
PPTX
The taipei 101 tower
PPTX
Mac book
PPT
Apple i phone presentation
Simple Blockchain Eco System for medical data management
A mini project on designing a DATABASE for Library management system using mySQL
A Computers Architecture project on Barrel shifters
A JAVA project on Marriage bureau management system
A Measurements Project on Light Detection sensor
A Software Engineering Project on Cyber cafe management
A project on Ecology case studies
A project on advanced C language
A MATLAB project on LCR circuits
10_CERITIFICATE
Pedal power hacksaw
The taipei 101 tower
Mac book
Apple i phone presentation

Recently uploaded (20)

PPTX
AD Bungalow Case studies Sem 2.pptxvwewev
PDF
Key Trends in Website Development 2025 | B3AITS - Bow & 3 Arrows IT Solutions
PDF
Design Thinking - Module 1 - Introduction To Design Thinking - Dr. Rohan Dasg...
PPTX
DOC-20250430-WA0014._20250714_235747_0000.pptx
PDF
Urban Design Final Project-Site Analysis
PPTX
Tenders & Contracts Works _ Services Afzal.pptx
PDF
SEVA- Fashion designing-Presentation.pdf
PDF
Facade & Landscape Lighting Techniques and Trends.pptx.pdf
DOCX
The story of the first moon landing.docx
PDF
Quality Control Management for RMG, Level- 4, Certificate
PPTX
An introduction to AI in research and reference management
PPT
WHY_R12 Uaafafafpgradeaffafafafaffff.ppt
PDF
Trusted Executive Protection Services in Ontario — Discreet & Professional.pdf
PPTX
AC-Unit1.pptx CRYPTOGRAPHIC NNNNFOR ALL
PPTX
areprosthodontics and orthodonticsa text.pptx
PPTX
Entrepreneur intro, origin, process, method
PPTX
rapid fire quiz in your house is your india.pptx
PPTX
mahatma gandhi bus terminal in india Case Study.pptx
PPTX
Special finishes, classification and types, explanation
PPTX
CLASS_11_BUSINESS_STUDIES_PPT_CHAPTER_1_Business_Trade_Commerce.pptx
AD Bungalow Case studies Sem 2.pptxvwewev
Key Trends in Website Development 2025 | B3AITS - Bow & 3 Arrows IT Solutions
Design Thinking - Module 1 - Introduction To Design Thinking - Dr. Rohan Dasg...
DOC-20250430-WA0014._20250714_235747_0000.pptx
Urban Design Final Project-Site Analysis
Tenders & Contracts Works _ Services Afzal.pptx
SEVA- Fashion designing-Presentation.pdf
Facade & Landscape Lighting Techniques and Trends.pptx.pdf
The story of the first moon landing.docx
Quality Control Management for RMG, Level- 4, Certificate
An introduction to AI in research and reference management
WHY_R12 Uaafafafpgradeaffafafafaffff.ppt
Trusted Executive Protection Services in Ontario — Discreet & Professional.pdf
AC-Unit1.pptx CRYPTOGRAPHIC NNNNFOR ALL
areprosthodontics and orthodonticsa text.pptx
Entrepreneur intro, origin, process, method
rapid fire quiz in your house is your india.pptx
mahatma gandhi bus terminal in india Case Study.pptx
Special finishes, classification and types, explanation
CLASS_11_BUSINESS_STUDIES_PPT_CHAPTER_1_Business_Trade_Commerce.pptx

A c program of Phonebook application

  • 1. 1 PROJECT TITLE: PhonebookApplication Adding new records into the memory, listing them, modifying them and updating, search for contacts saved, and deleting the phonebook contacts are the basic functions which make up the main menu of this Phonebook application (as shown in the main menu screenshot below). Personal information such as Name, gender, Father’s name, Mother’s name, phone number, email and address are asked while adding a record into the Phonebook. After the initial addition of the contacts these records are then be modified, listed, searched for and removed if they are requires a change. The program uses many functions in. These functions are easy to understand as their name only signifies their respective operations. These functions make the program to divide into individual modules and hence it makes the program simpler to understand. void menu () – This function is used to display the main menu. void start () – This functions calls the menu function mentioned above. void back () – This function is used to go back to start. void addrecord () – It adds a new Phonebook record. void listrecord () – This function is used to view list of added records in file. void modifyrecord () – This function is used to modify added records. void deleterecord () – It deletes record from file. void searchrecord () – It searches for added record by name. DONE BY: S.V.Rohith-150031000
  • 2. 2 ABSTRACT The Title of the Program is to develop a program which deals with the combination of structures, arrays, File pointers and other functions. This program could do some operations on arrays such as insertion, deletion, sorting, searching, update, retrieve, merging, append, exit. By implementing this program we can execute the inserted contact data, deletion of the data, searching, updating, append, exit with numbers by using arrays and file pointers. This program is implemented for only numbers that can enter into an array. To do this analysis manually it takes a lot of time and patience but by implementing this program using a high level language like C it becomes much easier. But before going to make final solution for the problem, the problem must be analysed. First of all the basic information regarding the program which consists of complex numbers. This program is solved by using several methods like one can solve this program using user defined functions concept, loops conditions, go to statements. In this abstract we used the concept of functions, while loop, for loop, switch case and if condition’s which helps to execute the problem much easier .The following steps are followed while implementing the given program using if and while loop.  The input is entered i.e., the value of choice (the menu no) select the particular menu.  Next it goes to particular menu and then go to the particular function.  It prints the resultant value which came from the execution. The outcome of the work is one can get the required changes like inserting or deleting or sorting or merging or append or retrieve or update or exit for a given array.
  • 3. 3 INDEX S.NO TITLE PAGE NO 1. Introduction 6 2. Aim of the Project 8 2.1 Advantages & Disadvantages 2.2 Future Implementation 3. Software & Hardware Details 8 4. Data Flow Diagram 9 5. Algorithm 13 6. Implementation 24
  • 4. 4 INTRODUCTION C is a structured, high level machine independent language. C is converted to a lower language which was understood by the compiler. It allows the software developers to develop programs without worrying about the hardware plat forms where there will be implemented. The c language comes from the ALGOL which gives the concept structured programming to the computer science community. It was introduced early in 1960’s. After, MARTIN RICHARDS DEVELOPED a language known as BCPL in 1967 for this in 1970’s ken Thompson created a language from BCPL and he called as “B” both BCPL and B are types less system programming languages. After finding ALGOL BCPL, AND B then from this c is evolved from that at BELL LABORATORIES in 1972 by “DENIS RITCHE”. C language uses many concepts from these and added the concept of data type because it was developed along with a UNIX operating system. UNIX is nothing but a most popular network operating system is used today and the heart of the internet data super high way. C-language is robust language because c-supports richest of operators and burden functions this consist of many operators, operands, key words, special characters, many characters. Features of c-programming:-  It is a structural programming language with fundamental flow control construction.  It is highly portable. The program written on one computer can run on another computer also without any modification or with a slight modification.  It contains 32 keywords.  It is simple and versatile programming language.  It is richest than all programs.  Dynamic memory allocation is possible in ‘c’. Structures We have seen that arrays can be used to represent a group of data items that belongs to same data type. If we want to represent a collection of data items of different data types using a single name, then we cannot use an array. C supports a constructed data type known as Structure, which is a method for packing data of different data types. A structure is a convenient tool for handling a group of logically related data items. Structures help to organize complex data in a more meaningful way. It is a powerful concept that we may often need to Use in our program design. Definition:
  • 5. 5 A group of data items that belongs to different data types is known as Structure. ‘Struct’ : It is a keyword and is used to declare a Structure. Declaration of structure: struct struct_name { Data item-1; Data item-2; ………… ………… Data item-n; }; Declaration of structure variable: struct struct_name identifier; (or) struct struct_name dentifier-1,identifier-2,.......,identifier-n; (Access operator): It is used to access the data items of a structure with the help of structure variable. Syntax: struct_variable . Data item;
  • 6. 6 AIM: • To develop a “Phonebook contact” application using c programming. • This program is very useful now-a-days to store complete information under single contact number. • This program also has options to deletion and modification of the entered contact number. Advantages: • It becomes easy for the user to store complete information (e-mail id, address, e.t.c) about his contact. • It is easy for the user to just search his required contact number by just typing name of the contact. Disadvantages: • Sometimes it becomes difficult to store more contacts (over 150). Future Enhancements:-  It becomes even difficult to store contacts with two or more contact numbers SOFTWARE REQUIREMENTS: • This application is developed in Microsoft windows xp or later operating system. • This Phonebook application is coded and made using the following compilers: 1. Code::blocks. 2. Turbo c. HARDWARE REQUIREMENTS: • This Application size is 33Kb and the size of the code is 5Kb so such amount of memory is required from hard disk. • RAM: minimum 256MB. • Mouse, keyboard.
  • 7. 7 DATA FLOW DIAGRAM: Read menu no Case 3: Case 6: n Module 6 Case 1:Module 1 Start Menu for Phonebook Application 1 Case 2:Module 2 Case 4: Module 5 Case 5: Module 4 Module 3
  • 8. 8 Default: Enter 1 to 6 only Module 2 Read Name,Address,Father Name,Mother Name,Phone number,Sex Print Record saved Read menu no Stop Module 1 Print All the contacts in the Phonebook Read menu no
  • 9. 9 Module 3 Print Your data modified Read the modified details Name,Address,Father Name,Mother Name,Phonenumber,Sex Read menu no Read the name entered to modify Print all the details of the searched contact Module 4 Read the name to be searched Read menu no
  • 10. 10 Module 5 Read menu no Read the name of the contact to be deleted Print Record deleted successfully
  • 11. 11 ALGORITHM: 1. Start. 2. Display the options on the screen. 3. Read name, address, father name, mother name, mobile number, gender. 4. Print “WELCOME TO PHONEBOOK” and “Menu” on the screen a. Add contact b. Print all contacts c. Modify contacts d. Search contact e. Delete contact f. Close phone book 5. Now for Addrecord (),arranging data as Enter name, Enter address, Enter father name, Enter mother name, Enter phone book no, Enter Gender and finally operations recordsaved , Enter any key. 6. Now for listrecord(), arranging data as a. if data is empty print file opening error in listing b. Else print your record: name, address, father, mother, mobile no, Gender. c. After all these print enter any key 7. Now for searchrecord(), arranging data as a. if data is insufficient print error in opening b. Else c. print enter name of contact to be searched and i. If (strcmp(p.name,name)==0) ii. print detail information about name and name, address, father name, mother name, mobile num, gender. d. After entering all these, print enter any key 8. Now for deleterecord(), arranging the data as a. If (f==null) b. print contact’s data not added yet i. else ii. if(f==null) iii. print file opening error iv. Else v. Print enter contact’s details. 9. if (flag!=1)
  • 12. 12 a. print no contact’s recordto delete b. Else c. print record deleted successfully d. After entering all the data print enter any key 10.for modifyrecord(),arranging the data as a. If (f==null) b. print contact’s data not added yet c. Else d. enter contact’s name to modify i. Print enter name , enter address , enter father name, enter mother name,mobile number, sex after entering the data ii. print your data is modified iii. Else iv. print data is not found v. Finally print enter any key. 11.Redisplay the menu for user required input.
  • 13. 13 Code of the application: #include<conio.h> #include<string.h> #include<stdio.h> struct contact { char nam[50]; char adres[50]; long int m_no; char gender[10]; char m_id[100]; }; void Menu(); void Data(); void ARec(); void ListRec(); void ModRec(); void DelRec(); void SRec(); int exit(); int main() { Menu(); return 0; } void Menu()
  • 14. 14 { printf("tt WELCOME TO PHONEBOOK"); printf("nntt MENU tnn"); printf("t1.List Contactst2.Add New Contactt3.Modify n"); printf("t4.Searcht5.Deletet6.Exitn"); switch(getch()) { case '1': ListRec(); break; case '2': ARec(); break; case '3': ModRec(); break; case '4': SRec(); break; case '5': DelRec(); break; case '6': exit(); break; default: printf("n Enter 1 to 6 only."); getch(); } } int exit() { Menu(); return 0;
  • 15. 15 } void ARec() { FILE *f; struct contact p; f=fopen("project","ab+"); printf("n Name: "); Data(p.nam); printf("nAddress: "); Data(p.adres); printf("nMobile no.:"); scanf("%ld",&p.m_no); printf("Gender:"); Data(p.gender); printf("ne-mail:"); Data(p.m_id); fwrite(&p,sizeof(p),1,f); fflush(stdin); printf("nrecord saved"); fclose(f); getch(); Menu(); } void ListRec() { struct contact p; FILE *f;
  • 16. 16 f=fopen("project","rb"); if(f==NULL) { printf("n No contacts detected yet!:n"); exit(); } while(fread(&p,sizeof(p),1,f)==1) { printf("nnn YOUR RECORD ISnn "); printf("nName=%snAdress=%snMobile no=%ldngender=%snE- mail=%s",p.nam,p.adres,p.m_no,p.gender,p.m_id); getch(); } fclose(f); getch(); Menu(); } void SRec() { struct contact p; FILE *f; char name[100]; f=fopen("project","rb"); if(f==NULL) { printf("n Error in openingn");
  • 17. 17 exit(); } printf("nEnter name of person to searchn"); Data(name); while(fread(&p,sizeof(p),1,f)==1) { if(strcmp(p.nam,name)==0) { printf("ntDetail Information About %s",name); printf("nName:%snaddress:%snMobile no:%ldngender:%snE- mail:%s",p.nam,p.adres,p.m_no,p.gender,p.m_id); } else printf("Not found"); } fclose(f); getch(); Menu(); } void DelRec() { struct contact p; FILE *f,*ft; int flag; char name[100]; f=fopen("project","rb");
  • 18. 18 if(f==NULL) printf("Contact data not yet added."); else { ft=fopen("temp","wb+"); if(ft==NULL) printf("file opening error"); else { printf("Enter contact name:"); Data(name); fflush(stdin); while(fread(&p,sizeof(p),1,f)==1) { if(strcmp(p.nam,name)!=0) fwrite(&p,sizeof(p),1,ft); if(strcmp(p.nam,name)==0) flag=1; } fclose(f); fclose(ft); if(flag!=1) { printf("No Record To Delete."); remove("temp.txt"); } else
  • 19. 19 { remove("project"); rename("temp.txt","project"); printf("Record Deleted"); } } } getch(); Menu(); } void ModRec() { int c; FILE *f; int flag=0; struct contact p,s; char nam[50]; f=fopen("project","rb+"); if(f==NULL) { printf("No Contact added yet!n"); exit(); } else {
  • 20. 20 printf("Enter Name to modify:n"); Data(nam); while(fread(&p,sizeof(p),1,f)==1) { if(strcmp(nam,p.nam)==0) { printf("nName:"); Data(s.nam); printf("nAddress:"); Data(s.adres); printf("nPhone no:"); scanf("%ld",&s.m_no); printf("nGender:"); Data(s.gender); printf("ne-mail:"); Data(s.m_id); fseek(f,-sizeof(p),SEEK_CUR); fwrite(&s,sizeof(p),1,f); flag=1; break; } fflush(stdin); } if(flag==1)
  • 21. 21 printf("n Your contact is modified"); else printf(" n Contact data not found"); fclose(f); } getch(); Menu(); } void Data(char *Name) { int i=0,j; char ch,cha; do { ch=getch(); if(ch!=8&&ch!=13) { *(Name+i)=ch; putch(ch); i++; } if(ch==8) { if(i>0) { i--;
  • 22. 22 } for(j=0;j<i;j++) { cha=*(Name+j); putch(cha); } } }while(ch!=13); *(Name+i)='0'; } Conclusion: This program makes the user simpler to connect to his contact. The contact personal information and family information is stored under a single number this would benefit the user to easily search and locate his required contact. This program deals with four operations of adding contacts, deleting them, modifying, searching according the user’s choice. Each operation is made as an individual function and so control enters to different structures and all the data added or modified or deleted is going to be stored in a .txt file using FILE pointers.