SlideShare a Scribd company logo
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

What's hot

C programming project by navin thapa
C programming project by navin thapaC programming project by navin thapa
C programming project by navin thapa
Navinthp
 
student application form Java Netbeans
student application form Java Netbeansstudent application form Java Netbeans
student application form Java Netbeans
reshmajohney
 

What's hot (20)

Project presentation on Phone Book
Project presentation on Phone BookProject presentation on Phone Book
Project presentation on Phone Book
 
Contact management system , phone book management system
Contact management system , phone book management systemContact management system , phone book management system
Contact management system , phone book management system
 
Telephone directory
Telephone directoryTelephone directory
Telephone directory
 
Data Structure Project File
Data Structure Project FileData Structure Project File
Data Structure Project File
 
BANK MANAGEMENT SYSTEM report
BANK MANAGEMENT SYSTEM reportBANK MANAGEMENT SYSTEM report
BANK MANAGEMENT SYSTEM report
 
Project report
Project reportProject report
Project report
 
Presentation of 3rd Semester C++ Project
Presentation of 3rd Semester C++ ProjectPresentation of 3rd Semester C++ Project
Presentation of 3rd Semester C++ Project
 
mini project in c using data structure
mini project in c using data structure mini project in c using data structure
mini project in c using data structure
 
Problem solving UNIT - 4 [C PROGRAMMING] (BCA I SEM)
Problem solving UNIT - 4 [C PROGRAMMING] (BCA I SEM)Problem solving UNIT - 4 [C PROGRAMMING] (BCA I SEM)
Problem solving UNIT - 4 [C PROGRAMMING] (BCA I SEM)
 
C programming project by navin thapa
C programming project by navin thapaC programming project by navin thapa
C programming project by navin thapa
 
Library management system
Library management systemLibrary management system
Library management system
 
Atm project
Atm projectAtm project
Atm project
 
Dbms lab questions
Dbms lab questionsDbms lab questions
Dbms lab questions
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 
Data Structures Practical File
Data Structures Practical File Data Structures Practical File
Data Structures Practical File
 
Lecture 5 - Structured Programming Language
Lecture 5 - Structured Programming Language Lecture 5 - Structured Programming Language
Lecture 5 - Structured Programming Language
 
student application form Java Netbeans
student application form Java Netbeansstudent application form Java Netbeans
student application form Java Netbeans
 
Billing project
Billing projectBilling project
Billing project
 
Student management system project report c++
Student management system project report c++Student management system project report c++
Student management system project report c++
 
linked lists in data structures
linked lists in data structureslinked lists in data structures
linked lists in data structures
 

Viewers also liked

Introduction and objectives of the project
Introduction and objectives of the projectIntroduction and objectives of the project
Introduction and objectives of the project
rihan696
 
Library Management System
Library Management SystemLibrary Management System
Library Management System
Aditya Shah
 
Library mangement system project srs documentation.doc
Library mangement system project srs documentation.docLibrary mangement system project srs documentation.doc
Library mangement system project srs documentation.doc
jimmykhan
 

Viewers also liked (12)

telephone directory
 telephone directory telephone directory
telephone directory
 
Phonebook Directory or Address Book In Android
Phonebook Directory or Address Book In AndroidPhonebook Directory or Address Book In Android
Phonebook Directory or Address Book In Android
 
Phonebook
PhonebookPhonebook
Phonebook
 
Phonebook
PhonebookPhonebook
Phonebook
 
University Management Information System
University Management Information SystemUniversity Management Information System
University Management Information System
 
University Management System
University Management SystemUniversity Management System
University Management System
 
Introduction and objectives of the project
Introduction and objectives of the projectIntroduction and objectives of the project
Introduction and objectives of the project
 
Hotel Management System
Hotel Management SystemHotel Management System
Hotel Management System
 
Library Management System PPT
Library Management System PPTLibrary Management System PPT
Library Management System PPT
 
Project Proposal document for Hotel Management System
Project Proposal document for Hotel Management SystemProject Proposal document for Hotel Management System
Project Proposal document for Hotel Management System
 
Library Management System
Library Management SystemLibrary Management System
Library Management System
 
Library mangement system project srs documentation.doc
Library mangement system project srs documentation.docLibrary mangement system project srs documentation.doc
Library mangement system project srs documentation.doc
 

Similar to A c program of Phonebook application

cminiproject-151115084708-lva1-app6892.pdf
cminiproject-151115084708-lva1-app6892.pdfcminiproject-151115084708-lva1-app6892.pdf
cminiproject-151115084708-lva1-app6892.pdf
TasnimAbida
 
BTE 320-498 Summer 2017 Take Home Exam (200 poi.docx
BTE 320-498 Summer 2017 Take Home Exam (200 poi.docxBTE 320-498 Summer 2017 Take Home Exam (200 poi.docx
BTE 320-498 Summer 2017 Take Home Exam (200 poi.docx
AASTHA76
 
Introduction to object oriented language
Introduction to object oriented languageIntroduction to object oriented language
Introduction to object oriented language
farhan amjad
 
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
C notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit orderC notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit order
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
Malikireddy Bramhananda Reddy
 

Similar to A c program of Phonebook application (20)

Cse project-1
Cse project-1Cse project-1
Cse project-1
 
Bangladesh university of business and technology
Bangladesh university of business and technologyBangladesh university of business and technology
Bangladesh university of business and technology
 
cminiproject-151115084708-lva1-app6892.pdf
cminiproject-151115084708-lva1-app6892.pdfcminiproject-151115084708-lva1-app6892.pdf
cminiproject-151115084708-lva1-app6892.pdf
 
Introduction to ‘C’ Language
Introduction to ‘C’ LanguageIntroduction to ‘C’ Language
Introduction to ‘C’ Language
 
Notes of c programming 1st unit BCA I SEM
Notes of c programming  1st unit BCA I SEMNotes of c programming  1st unit BCA I SEM
Notes of c programming 1st unit BCA I SEM
 
6272 cnote
6272 cnote6272 cnote
6272 cnote
 
C progrmming
C progrmmingC progrmming
C progrmming
 
Book management system
Book management systemBook management system
Book management system
 
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshuunit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
 
A Hand Book of Visual Basic 6.0.pdf.pdf
A Hand Book of Visual Basic 6.0.pdf.pdfA Hand Book of Visual Basic 6.0.pdf.pdf
A Hand Book of Visual Basic 6.0.pdf.pdf
 
BTE 320-498 Summer 2017 Take Home Exam (200 poi.docx
BTE 320-498 Summer 2017 Take Home Exam (200 poi.docxBTE 320-498 Summer 2017 Take Home Exam (200 poi.docx
BTE 320-498 Summer 2017 Take Home Exam (200 poi.docx
 
Introduction to object oriented language
Introduction to object oriented languageIntroduction to object oriented language
Introduction to object oriented language
 
Grade 11-Q1_W3-PECS_AQS.pdf
Grade 11-Q1_W3-PECS_AQS.pdfGrade 11-Q1_W3-PECS_AQS.pdf
Grade 11-Q1_W3-PECS_AQS.pdf
 
C AND DATASTRUCTURES PREPARED BY M V B REDDY
C AND DATASTRUCTURES PREPARED BY M V B REDDYC AND DATASTRUCTURES PREPARED BY M V B REDDY
C AND DATASTRUCTURES PREPARED BY M V B REDDY
 
Cpp Homework Help
Cpp Homework Help Cpp Homework Help
Cpp Homework Help
 
Intro To C++ - Class 14 - Midterm Review
Intro To C++ - Class 14 - Midterm ReviewIntro To C++ - Class 14 - Midterm Review
Intro To C++ - Class 14 - Midterm Review
 
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
C notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit orderC notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit order
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
 
Programming In C++
Programming In C++ Programming In C++
Programming In C++
 
10th class computer science notes in english by cstechz
10th class computer science notes in english by cstechz10th class computer science notes in english by cstechz
10th class computer science notes in english by cstechz
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptx
 

More from svrohith 9

10_CERITIFICATE
10_CERITIFICATE10_CERITIFICATE
10_CERITIFICATE
svrohith 9
 

More from svrohith 9 (14)

Simple Blockchain Eco System for medical data management
Simple Blockchain Eco System for medical data managementSimple Blockchain Eco System for medical data management
Simple Blockchain Eco System for medical data management
 
A mini project on designing a DATABASE for Library management system using mySQL
A mini project on designing a DATABASE for Library management system using mySQLA mini project on designing a DATABASE for Library management system using mySQL
A mini project on designing a DATABASE for Library management system using mySQL
 
A Computers Architecture project on Barrel shifters
A Computers Architecture project on Barrel shiftersA Computers Architecture project on Barrel shifters
A Computers Architecture project on Barrel shifters
 
A JAVA project on Marriage bureau management system
A JAVA project on Marriage bureau management systemA JAVA project on Marriage bureau management system
A JAVA project on Marriage bureau management system
 
A Measurements Project on Light Detection sensor
A Measurements Project on Light Detection sensorA Measurements Project on Light Detection sensor
A Measurements Project on Light Detection sensor
 
A Software Engineering Project on Cyber cafe management
A Software Engineering Project on Cyber cafe managementA Software Engineering Project on Cyber cafe management
A Software Engineering Project on Cyber cafe management
 
A project on Ecology case studies
A project on Ecology case studiesA project on Ecology case studies
A project on Ecology case studies
 
A project on advanced C language
A project on advanced C languageA project on advanced C language
A project on advanced C language
 
A MATLAB project on LCR circuits
A MATLAB project on LCR circuitsA MATLAB project on LCR circuits
A MATLAB project on LCR circuits
 
10_CERITIFICATE
10_CERITIFICATE10_CERITIFICATE
10_CERITIFICATE
 
Pedal power hacksaw
Pedal power hacksawPedal power hacksaw
Pedal power hacksaw
 
The taipei 101 tower
The taipei 101 towerThe taipei 101 tower
The taipei 101 tower
 
Mac book
Mac bookMac book
Mac book
 
Apple i phone presentation
Apple i phone presentationApple i phone presentation
Apple i phone presentation
 

Recently uploaded

Heuristic Evaluation of System & Application
Heuristic Evaluation of System & ApplicationHeuristic Evaluation of System & Application
Heuristic Evaluation of System & Application
Jaime Brown
 
Research about Venice ppt for grade 6f anas
Research about Venice ppt for grade 6f anasResearch about Venice ppt for grade 6f anas
Research about Venice ppt for grade 6f anas
anasabutalha2013
 
National-Learning-Camp 2024 deped....pptx
National-Learning-Camp 2024 deped....pptxNational-Learning-Camp 2024 deped....pptx
National-Learning-Camp 2024 deped....pptx
AlecAnidul
 

Recently uploaded (14)

The Design Code Google Developer Student Club.pptx
The Design Code Google Developer Student Club.pptxThe Design Code Google Developer Student Club.pptx
The Design Code Google Developer Student Club.pptx
 
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdfPORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
 
Claire's designing portfolio presentation
Claire's designing portfolio presentationClaire's designing portfolio presentation
Claire's designing portfolio presentation
 
Heuristic Evaluation of System & Application
Heuristic Evaluation of System & ApplicationHeuristic Evaluation of System & Application
Heuristic Evaluation of System & Application
 
BIT- Pinal .H. Prajapati Graphic Designer
BIT- Pinal .H. Prajapati  Graphic DesignerBIT- Pinal .H. Prajapati  Graphic Designer
BIT- Pinal .H. Prajapati Graphic Designer
 
CA OFFICE office office office _VIEWS.pdf
CA OFFICE office office office _VIEWS.pdfCA OFFICE office office office _VIEWS.pdf
CA OFFICE office office office _VIEWS.pdf
 
Art Nouveau Movement Presentation for Art History.
Art Nouveau Movement Presentation for Art History.Art Nouveau Movement Presentation for Art History.
Art Nouveau Movement Presentation for Art History.
 
Pitch Presentation for Service Design in Technology
Pitch Presentation for Service Design in TechnologyPitch Presentation for Service Design in Technology
Pitch Presentation for Service Design in Technology
 
Design lessons from Singapore | Volume 3
Design lessons from Singapore | Volume 3Design lessons from Singapore | Volume 3
Design lessons from Singapore | Volume 3
 
Research about Venice ppt for grade 6f anas
Research about Venice ppt for grade 6f anasResearch about Venice ppt for grade 6f anas
Research about Venice ppt for grade 6f anas
 
The Evolution of Fashion Trends: History to Fashion
The Evolution of Fashion Trends: History to FashionThe Evolution of Fashion Trends: History to Fashion
The Evolution of Fashion Trends: History to Fashion
 
National-Learning-Camp 2024 deped....pptx
National-Learning-Camp 2024 deped....pptxNational-Learning-Camp 2024 deped....pptx
National-Learning-Camp 2024 deped....pptx
 
Spring 2024 wkrm_Enhancing Campus Mobility.pdf
Spring 2024 wkrm_Enhancing Campus Mobility.pdfSpring 2024 wkrm_Enhancing Campus Mobility.pdf
Spring 2024 wkrm_Enhancing Campus Mobility.pdf
 
Common Designing Mistakes and How to avoid them
Common Designing Mistakes and How to avoid themCommon Designing Mistakes and How to avoid them
Common Designing Mistakes and How to avoid them
 

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.