Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Lab project report in C phone directory code, Lab Reports of C programming

Lab project report in C phone directory code

Typology: Lab Reports

2021/2022

Uploaded on 11/23/2022

sam-dolue
sam-dolue 🇮🇳

12 documents

1 / 25

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PHONEBOOK APPLICATION
ABSTRACT:
Phone book application is primarily meant for keeping the records of the persons. Phone book
application will provide the basic set of features of adding a new contact, searching, updating, deleting a
contact .This mini project in C Phonebook allows to perform simple Phonebook operations like in the
mobile. One can add, list, modify, search and delete Phonebook-related records. File handling and data
structure concepts has been extensively used for almost all functions in this mini project. Phonebook in C is
a console application without graphics. The source code is complete and totally error-free. It is compiled in
Code Blocks with GCC compiler. Functions, file handling and data structure are used. This application
contains how to add, list, modify or edit, search and delete data to/from the file. Adding new records,
listing them, modifying them and updating, search for contacts saved, and deleting the phonebook records
are the basic functions which make up the main menu of this Phonebook application .Personal information
such as name, gender, father’s name, phone number, citizenship number, email and address are asked while
adding a record into the Phonebook. These records can then be modified, listed, searched for and removed.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Lab project report in C phone directory code and more Lab Reports C programming in PDF only on Docsity!

PHONEBOOK APPLICATION

ABSTRACT:

Phone book application is primarily meant for keeping the records of the persons. Phone book application will provide the basic set of features of adding a new contact, searching, updating, deleting a contact .This mini project in C Phonebook allows to perform simple Phonebook operations like in the mobile. One can add, list, modify, search and delete Phonebook-related records. File handling and data structure concepts has been extensively used for almost all functions in this mini project. Phonebook in C is a console application without graphics. The source code is complete and totally error-free. It is compiled in Code Blocks with GCC compiler. Functions, file handling and data structure are used. This application contains how to add, list, modify or edit, search and delete data to/from the file. Adding new records, listing them, modifying them and updating, search for contacts saved, and deleting the phonebook records are the basic functions which make up the main menu of this Phonebook application .Personal information such as name, gender, father’s name, phone number, citizenship number, email and address are asked while adding a record into the Phonebook. These records can then be modified, listed, searched for and removed.

INDEX

S.NO TITLE P.NO

1. INTRODUCTION

2. PROGRAMMING LANGUAGE

3. FLOW CHART

4. SOURCE CODE

5. OUTPUT

6. CONCLUSION

7. REFERENCES

and standard applications are not context dependent and therefore the caller has very little chance to know when making a call in what situation the called party will be interrupted. The main idea of the program is to increase the awareness of working with computer systems and utilize computer resources for better result orientation. The main target behind the creation of this package is to remove the pressure from the user to learn about computer & software. It helps to maintain an automatic communication between the computer and the user. This Program “My Phonebook” facility the user with different records can add and search easily by using Button tools & Search options. There are some features also like: - Viewing Data in Data grid, and Logout. Our Project has following :- Login form “ADD” button for adding data in Database. “DELETE” button for deleting data in Database. “UPDATE” button for updating data in Database. “SEARCH” button for searching data in Database.

PROGRAMMING LANGUAGE-C

C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC PDP- computer in 1972. In 1978, Brian Kernighan and Dennis Ritchie produced the first publicly available description of C, now known as the K&R standard. The UNIX operating system, the C compiler, and essentially all UNIX application programs have been written in C. C has now become a widely used professional language for various reasons −  Easy to learn.  Structured language.  It produces efficient programs.  It can handle low-level activities  It can be compiled on a variety of computer platforms.

FLOWCHART

Start

Homepage

Add Modify

display Search delete

EXIT

PROGRAM OF PHONEBOOK APPLICATION USING C

#include<stdio.h> #include<conio.h> #include<string.h> #include<stdlib.h> #include<windows.h> struct person { char name[35]; char address[50]; char father_name[35]; char mother_name[30]; long int mble_no;

printf("\n\n\t\t\t MENU\t\t\n\n"); printf("\t1.Add New \t2.List \t3.Exit \n\t4.Modify \t5.Search\t6.Delete"); switch(getch()) { case '1':addrecord(); break; case '2': listrecord(); break; case '3': exit(0); break; case '4': modifyrecord(); break; case '5': searchrecord(); break; case '6': deleterecord(); break; default: system("cls"); printf("\nEnter 1 to 6 only"); printf("\n Enter any key"); getch(); menu(); } } void addrecord() { system("cls"); FILE *f; struct person p; f=fopen("project","ab+"); printf("\n Enter name: ");

got(p.name); printf("\nEnter the address: "); got(p.address); printf("\nEnter father name: "); got(p.father_name); printf("\nEnter mother name: "); got(p.mother_name); printf("\nEnter phone no.:"); scanf("%ld",&p.mble_no); printf("Enter sex:"); got(p.sex); printf("\nEnter e-mail:"); got(p.mail); printf("\nEnter citizen no:"); got(p.citision_no); fwrite(&p,sizeof(p),1,f); fflush(stdin); printf("\nrecord saved"); fclose(f); printf("\n\nEnter any key"); getch(); system("cls"); menu(); } void listrecord() { struct person p; FILE *f; f=fopen("project","rb");

printf("\nEnter name of person to search\n"); got(name); while(fread(&p,sizeof(p),1,f)==1) { if(strcmp(p.name,name)==0) { printf("\n\tDetail Information About %s",name); printf("\nName:%s\naddress:%s\nFather name:%s\nMother name:%s\nMobile no:%ld\nsex:%s\nE- mail:%s\nCitision no: %s",p.name,p.address,p.father_name,p.mother_name,p.mble_no,p.sex,p.mail,p.citision_no); } else printf("file not found"); } fclose(f); printf("\n Enter any key"); getch(); system("cls"); menu(); } void deleterecord() { struct person p; FILE f,ft; int flag; char name[100]; f=fopen("project","rb"); if(f==NULL) {

printf("CONTACT'S DATA NOT ADDED YET."); } else { ft=fopen("temp","wb+"); if(ft==NULL) printf("file opaning error"); else { printf("Enter CONTACT'S NAME:"); got(name); fflush(stdin); while(fread(&p,sizeof(p),1,f)==1) { if(strcmp(p.name,name)!=0) fwrite(&p,sizeof(p),1,ft); if(strcmp(p.name,name)==0) flag=1; } fclose(f); fclose(ft); if(flag!=1) { printf("NO CONACT'S RECORD TO DELETE."); remove("temp.txt"); }

system("cls"); printf("\nEnter CONTACT'S NAME TO MODIFY:\n"); got(name); while(fread(&p,sizeof(p),1,f)==1) { if(strcmp(name,p.name)==0) { printf("\n Enter name:"); got(s.name); printf("\nEnter the address:"); got(s.address); printf("\nEnter father name:"); got(s.father_name); printf("\nEnter mother name:"); got(s.mother_name); printf("\nEnter phone no:"); scanf("%ld",&s.mble_no); printf("\nEnter sex:"); got(s.sex); printf("\nEnter e-mail:"); got(s.mail); printf("\nEnter citizen no\n"); got(s.citision_no); fseek(f,-sizeof(p),SEEK_CUR); fwrite(&s,sizeof(p),1,f); flag=1; break;

fflush(stdin); } if(flag==1) { printf("\n your data id modified"); } else { printf(" \n data is not found"); } fclose(f); } printf("\n Enter any key"); getch(); system("cls"); menu(); } void got(char *name) { int i=0,j; char c,ch; do { c=getch(); if(c!=8&&c!=13)