Beruflich Dokumente
Kultur Dokumente
Chapter 1
Introduction
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.
The program development process includes three important stages, namely, program
design, program coding and program testing. All the three stages contribute to the
production of high quality program.
We can improve the efficiency of the system, thus overcome the drawbacks of the
existing system.
· Less human error
· Strength and strain of manual labour can be reduced
· High security
· Data consistency
· Easy to handle
· Easy data updating
· Easy record keeping
· Backup data can be easily general
Chapter 2
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 goto 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.
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:
A group of data items that belongs to different data types is known as Structure.
Declaration of structure:
structstruct_name
{
Data item-1;
Data item-2;
…………
…………
Data item-n;
};
structstruct_name identifier;
(or)
structstruct_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;
AIM:
• 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:
Future Enhancements:-
It becomes even difficult to store contacts with two or more contact numbers
SOFTWARE REQUIREMENTS:
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.
Chapter 3
Result and Discussion
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 CONTACT MANAGEMENT SYSTEM” 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
phone no, Email ID and finally operations record saved ,Enter any key.
6. Now for listrecord(),arranging data as
a. if data is empty print file opening error in listing
b. Elseprint your record: name,address,mobile no, Email ID
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,mobilenum, Email.
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)
int main()
{
main:
system("cls"); /* ************Main menu
*********************** */
printf("\n\t **** Welcome to Contact Management System ****");
printf("\n\n\n\t\t\tMAIN MENU\n\t\t=====================\n\t\t[1]
Add a new Contact\n\t\t[2] List all Contacts\n\t\t[3] Search for
contact\n\t\t[4] Edit a Contact\n\t\t[5] Delete a Contact\n\t\t[0]
Exit\n\t\t=================\n\t\t");
printf("Enter the choice:");
scanf("%d",&ch);
switch(ch)
{
case 0:
break;
case 1:
system("cls");
fp=fopen("contact.dll","a");
for (;;)
{
fflush(stdin);
scanf("%[^\n]",&list.name);
break;
fflush(stdin);
printf("Phone:");
scanf("%ld",&list.ph);
fflush(stdin);
printf("address:");
scanf("%[^\n]",&list.add);
fflush(stdin);
printf("email address:");
gets(list.email);
printf("\n");
fwrite(&list,sizeof(list),1,fp);
fclose(fp);
break;
/* ****************list of contacts***********************/
case 2:
system("cls");
printf("\n\t\t================================\n\t\t\tLIST OF
CONTACTS\n\t\t================================\n\nName\
t\tPhone No\t Address\t\tE-mail
ad.\n=================================================
================\n\n");
fp=fopen("contact.dll","r");
fflush(stdin);
found=0;
while(fread(&list,sizeof(list),1,fp)==1)
if(list.name[0]==i || list.name[0]==i-32)
list.ph,list.add,list.email);
found++;
if(found!=0)
{
printf("===============================================
============ [%c]-(%d)\n\n",i-32,found);
getch();
}
fclose(fp);
break;
/* *******************search contacts**********************
*/
case 3:
system("cls");
do
found=0;
printf("\n\n\t..::CONTACT
SEARCH\n\t===========================\n\t..::Name of contact
to search: ");
fflush(stdin);
scanf("%[^\n]",&query);
l=strlen(query);
fp=fopen("contact.dll","r");
system("cls");
while(fread(&list,sizeof(list),1,fp)==1)
name[i]=list.name[i];
name[l]='\0';
if(stricmp(name,query)==0)
found++;
if (found%4==0)
getch();
if(found==0)
else
fclose(fp);
scanf("%d",&ch);
}
while(ch==1);
break;
/* *********************editcontacts************************/
case 4:
system("cls");
fp=fopen("contact.dll","r");
ft=fopen("temp.dat","w");
fflush(stdin);
printf("..::Edit
contact\n===============================\n\n\t..::Enter the
name of contact to edit:");
scanf("%[^\n]",name);
while(fread(&list,sizeof(list),1,fp)==1)
if(stricmp(name,list.name)!=0)
fwrite(&list,sizeof(list),1,ft);
fflush(stdin);
printf("\n\n..::Editing '%s'\n\n",name);
printf("..::Name(Use identical):");
scanf("%[^\n]",&list.name);
fflush(stdin);
printf("..::Phone:");
scanf("%ld",&list.ph);
fflush(stdin);
printf("..::address:");
scanf("%[^\n]",&list.add);
fflush(stdin);
printf("..::email address:");
gets(list.email);
printf("\n");
fwrite(&list,sizeof(list),1,ft);
fclose(fp);
fclose(ft);
remove("contact.dll");
rename("temp.dat","contact.dll");
break;
/* ********************deletecontacts**********************/
case 5:
system("cls");
fflush(stdin);
printf("\n\n\t..::DELETE A
CONTACT\n\t==========================\n\t..::Enter the name
of contact to delete:");
scanf("%[^\n]",&name);
fp=fopen("contact.dll","r");
ft=fopen("temp.dat","w");
while(fread(&list,sizeof(list),1,fp)!=0)
if (stricmp(name,list.name)!=0)
fwrite(&list,sizeof(list),1,ft);
fclose(fp);
fclose(ft);
remove("contact.dll");
rename("temp.dat","contact.dll");
break;
default:
printf("Invalid choice");
break;
scanf("%d",&ch);
switch (ch)
case 1:
goto main;
case 0:
break;
default:
printf("Invalid choice");
break;
return 0;
SCREENSHOTS:
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.
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.
REFERENCE:
[1] https://genesisdatabase.wordpress.com/2010/10/11/simple-phonebook-
[2] https://www.codeproject.com/Messages/44740/C-programming-phonebook-