Sei sulla pagina 1di 25

RAGHU INSTITUTE OF TECHNOLOGY

(AUTONOMOUS)

Dakamarri (v), Bheemunipatnam (M),Visakhapatnam Dist, Andhra Pradesh, PIN-531162

(Approved by AICTE, Accredited by NBA and NACC –‘A’ Grade, and permanently affiliated to JNTU Kakinada,
Andhrapradesh)

2018 – 2019 B. Tech., CSE I - Semester

CONTACT MANAGEMENT SYSTEM


MINI PROJECT

For

C- PROGRAMMING
Prepared By

BH.SAI SURENDRA,CH.SAI SAMPATH,


D.GOUTHAM,B.ADITYA,B.YASWANTH,D.TARUN

DEPARTMENT

OF

COMPUTER SCIENCE AND ENGINEERING


RAGHU INSTITUTE OF TECHNOLOGY
AUTONOMOUS

Dakamarri (v), Bheemunipatnam (M)

Visakhapatnam Dist, Andhra Pradesh, PIN-531162

(Approved by AICTE, Accredited by NBA and NACC –‘A’ Grade, and permanently affiliated to JNTU Kakinada,
Andhrapradesh)

CERTIFICATE

Name of the Laboratory : C- Programming, Mini Project

Name of the Students : BH.SAI SURENDRA, CH.SAI SAMPATH,


D.GOUTHAM, B.ADITYA, B.YASWANTH, D.TARUN

Department : CSE

Program : B.TECH

Year : 2018 – 2019

Semester : I
OBJECTIVES
The project is mainly based on following objectives:

 To create a project using C-programming and its features.

 To implement features like control statements, structures and file handling.

 To be familiar with resource reusability by making user defined function.

 To make the program easy while running it.

 To concise the memory of program as far as possible.

 To get an idea about making a simple project using C.

 To be able to solve problems by Compiling and Debugging.

 To learn about different dairy functions included in different header files.

 To learn about the use of user defined function, structure, array and data file in

 To learn to be able to develop complex programs aimed at solving particular

task in practical field as per user requirements.

 To be able to work in group as a team sharing different responsibilities.


INTRODUCTION
The mini project “Contact Management System” is the sample project for managing
student details. The project aims at developing student management system using
the C language that enables an organization to maintain its library.
The application uses basic C++ functions to generate menus, show message boxes
and print text on the screen.
To display customized text with colors and fonts according to application
requirements , functions have been created in the application ,which fetch the exact
video memory address of a target location, to write text at particular location.
The application also implements the concept of structures to define the contact
items. It also effectively applies the various C concepts such as file operations,
looping and branching constructs and string manipulation functions.
On a daily basis, everyone depends on a lot of contacts which cannot be
remembered so easily as it’s tough to do so. Hence dependability increases on
phones. What will be the situation if our phone is lost and we do not easily
remember our contacts and other important stuff? Idea is to come up with an app
which will be a partial remedy to the phone. So let us try an app which will allow
saving info like LastName, Firstname, Middlename, Phone number, email id, upload
pic etc.
It will be multi user application secured as personal data and saved contact details
will not be accessible to other users. The other option will be like save notes which
will allow user type down anything which can be kept as an info related to
passwords or info related to business deals, or info related to id’s or ticket numbers
etc.
ALGORITHM
SOURCE CODE
/*For the following program the username is RIT and the password is RIT22 .You can change that in the
program if u needed.*/.

#include<stdio.h>

#include<conio.h>

#include<string.h>

#include<process.h>

#include<stdlib.h>

#include<dos.h>

void login()
{
int a=0,i=0;
char uname[10],c=' ';
char pword[10],code[10];
char user[10]="user";
char pass[10]="pass";
do
{

printf("\n \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\
LOGIN FORM
\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\ ");
printf(" \n\n ENTER USERNAME:-");
scanf("%s", &uname);
printf(" \n\n ENTER PASSWORD:-");
while(i<10)
{
pword[i]=getch();
c=pword[i];
if(c==13) break;
else printf("*");
i++;
}
pword[i]='\0';
//char code=pword;
i=0;
//scanf("%s",&pword);
if(strcmp(uname,"user")==0 && strcmp(pword,"pass")==0)
{
printf(" \n\n\n WELCOME TO CONTACT MANAGEMENT SYSTEM !!!! LOGIN
IS SUCCESSFUL");
printf("\n\n\n\t\t\t\tPress any key to continue...");
getch();//holds the screen
break;
}
else
{
printf("\n SORRY !!!! LOGIN IS UNSUCESSFUL");
a++;

getch();//holds the screen

}
}
while(a<=2);
if (a>2)
{
printf("\nSorry you have entered the wrong username and password for four
times!!!");

getch();

}
system("cls");

struct contact

long ph;

char name[20],add[20],email[30];

} list;

char query[20],name[20];

FILE *fp, *ft;

int i,n,ch,l,found;
int main()

main:
login();
//time_t t;
//time(&t);

system("cls"); /* ************Main menu *********************** */

printf("\n\t \xB2\xB2\xB2\xB2\xB2\xB2 Contact Management System


\xB2\xB2\xB2\xB2\xB2\xB2");

printf("\n\n\n\t\t\tMAIN
MENU\n\t\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\x
B2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\n\t\t<1> Add 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\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\
xB2\xB2\xB2\xB2\xB2\xB2\xB2\n\t\t");
for(i=0;i<50;i++)
printf("-");
// printf("\n\t\tCurrent date and time : %s",ctime(&t));

printf("\n\t\tYour Choice:");

scanf("%d",&ch);

switch(ch)

case 0:

printf("\n\n\t\tAre you sure you want to exit?");

break;

/* *********************Add new contacts************ */

case 1:

system("cls");

fp=fopen("contact.dll","a");
for (;;)

{
fflush(stdin);

printf("\nFullName :");

scanf("%[^\n]",&list.name);

if(stricmp(list.name,"")==0 || stricmp(list.name," ")==0)

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);
break;

fclose(fp);

/* *********************list of contacts************************* */

case 2:
system("cls");

printf("\n\t\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\x
B2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\n\t\t\tLIST OF
CONTACTS\n\t\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\
xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\n\nName\t\tPhone
No\t Address\t\tE-mail
ad.\n=================================================================
\n\n");

for(i=97; i<=122; i=i+1)

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)

printf("\nName\t: %s\nPhone\t: %ld\nAddress\t: %s\nEmail\t: %s\n",list.name,

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");

printf("\n\n..::Search result for '%s'


\n===================================================\n",query);

while(fread(&list,sizeof(list),1,fp)==1)

for(i=0; i<=l; i++)

name[i]=list.name[i];
name[l]='\0';

if(stricmp(name,query)==0)

printf("\n..::Name\t: %s\n..::Phone\t: %ld\n..::Address\t: %s\n..::Email\t:


%s\n",list.name,list.ph,list.add,list.email);

found++;

if (found%4==0)

printf("..::Press any key to continue...");

getch();

if(found==0)

printf("\n..::No match found!");

else

printf("\n..::%d match(s) found!",found);

fclose(fp);

printf("\n ..::Try again?\n\n\t[1] Yes\t\t[0] No\n\t");

scanf("%d",&ch);

}
while(ch==1);

break;
/* *********************edit contacts************************/

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;

/* ********************delete contacts**********************/

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;

printf("\n\n\n..::Enter the Choice:\n\n\t[1] Main Menu\t\t[0] Exit\n");

scanf("%d",&ch);

switch (ch)

case 1:

goto main;

case 0:

break;

default:

printf("Invalid choice");

break;

return 0;

}
OUTPUT SCREENS
LOGIN FORM:

MENU :
TO ADD NEW CONTACT:

TO VIEW ALL CONTACTS:


TO SEARCH A CONTACT:
TO EDIT A CONTACT:
TO DELETE A CONTACT:

TO EXIT FROM THE PROGRAM:


PRESENT SYSYTEM AND DRAWBACK
CONCLUSION:
SUBMITTED BY, GUIDED BY,

1) BH.SAI SURENDRA ( 183JIAO522) M.SATISH KUMAR(PROFESSOR)

2) CH.SAMPATH KUMAR (183J1AO5303)

3) D.GOUTHAM (183J1A0541)

4) B.YESWANTH SAI ( 183J1AO517)

5) B.HARI ADITYA (183J1A0511)

6) THARUN (183J1AO545)

REFERENCES
1) M.SATISH KUMAR , Assistant professor, C language material, 2018-19, Raghu
Institute Of Technology.
2)BALAGURUSWAMY . E . Programming in ANSI C, the Tata McGraw-Hill
Companies,8th Edition 2018
3)Borland Turbo C and C++ 5.02
4)Programming in C ,REEMA THAREJA, second edition, Oxford.

Potrebbero piacerti anche