Contacts Manager – Mini Project in C with source code
This is one of the mini-project that you can get started with C projects. The project is Contacts Manager using a C programming language. It is done using structure and control statements in C. It is a simple project made using the console application of C. This means, no graphics component is added. The main target user of this project is the C beginners who want to make the project in C programming language and especially those who are interested in learning the Class in C language.
Loading…
Features of the mini-project are as below:-
- Add a New Contact
- List all contacts
- Search for contact
- Edit a contact
- Delete a contact
The complete source code for the project is given below:
/**********************************************************************************
Program Name : Contacts Manager
Language Used : C
***********************************************************************************/
#include
#include
#include
#include
#include
#include
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:
system("cls"); /* ************Main menu *********************** */
printf("\n\t **** Welcome to contact Manager ****");
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:
printf("\n\n\t\tAre you sure u want to exit?");
break;
/* *********************add new contacts************ */
case 1:
system("cls");
fp=fopen("contact.dll","a");
for (;;)
{ fflush(stdin);
printf("To exit enter blank space in the name input\nName (Use identical):");
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);
}
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");
for(i=97;i
Loading...