Contact Management System in c [Mini Project]

Contact Management System in c [Mini Project]

Contact Management System in c [ Mini Project] is a purely graphical console application. It is similar to cell phone contact manager. You can add, view, edit, look for and delete contacts in this project. All records that are inserted and updated are saved to a file.

You can list contacts by name, telephone number, address and email. All data was recorded using file handling. I used data structure to store the username, email and contact.

Ultimately, knowing this project's clear source code can teach you how to add, edit, scan, list and delete data using a script.

The source code for project contact management framework in C is complete and fully error-free. It is fast and clear-just over 200 pixels. The source code and application file can be downloaded from the link below and compiled under Code::Blocks IDE or DevC++ IDE.

Adzetech images

Contact Management System in C:

The main things that make up this simple C mini project are file handling, data structure, functions, and pointers. Contact management system core features are listed below:

  • Add new contacts: with information such as name, phone number, address and email
  • List all contacts: lists all contacts stored in the file with their respective contact details
  • Search contacts: on the basis of the name and phone number
  • Edit contacts: edit information given when adding contacts – name, phone number, address and email
  • Contact delete: delete contacts from file

This project uses the data structures and file handling. This is constructed just like a console application that is suitable for beginners to learn and make simple mini projects.

More Images

Adzetech images

Full Source code :

#include<stdio.h>

#include<conio.h>

#include<string.h>

#include<process.h>

#include<stdlib.h>

#include<dos.h>

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("nt **** Welcome to Contact Management System ****");

    printf("nnntttMAIN MENUntt=====================ntt[1] Add a new Contactntt[2] List all Contactsntt[3] Search for contactntt[4] Edit a Contactntt[5] Delete a Contactntt[0] Exitntt=================ntt");

    printf("Enter the choice:");

    scanf("%d",&ch);

    switch(ch)

    {

    case 0:

        printf("nnttAre you sure you 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 inputnName (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("ntt================================ntttLIST OF CONTACTSntt================================nnNamettPhone Not    AddressttE-mail ad.n=================================================================nn");

        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("nNamet: %snPhonet: %ldnAddresst: %snEmailt: %sn",list.name,

                           list.ph,list.add,list.email);

                    found++;

                }

            }

            if(found!=0)

            {
                printf("=========================================================== [%c]-(%d)nn",i-32,found);

                getch();
            }

            fclose(fp);

        }

        break;

        /* *******************search contacts**********************  */

    case 3:

        system("cls");

        do

        {

            found=0;

            printf("nnt..::CONTACT SEARCHnt===========================nt..::Name of contact to search: ");

            fflush(stdin);

            scanf("%[^n]",&query);

            l=strlen(query);

            fp=fopen("contact.dll","r");

            system("cls");

            printf("nn..::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]='';

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

                {

                    printf("n..::Namet: %sn..::Phonet: %ldn..::Addresst: %sn..::Emailt: %sn",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?nnt[1] Yestt[0] Nont");

            scanf("%d",&ch);

        }
        while(ch==1);

        break;


/*================================================================

			INCOMPLETE SOURCE CODE
			DOWNLOAD FROM BELOW => COMPLETE SOURCE
							
==================================================================*/

It project can be used as a guide for your mini project at the college. Try to write your own code, and make a new project. If you do, you can share it with use.

From this project, you can learn how to effectively use file handling, data structure, and pointers, especially how to record, modify, scan, display, and delete data in a file. It is absolutely disincentive to apply this mini project on Contact Management System in C with little or no change.

Leave comment

Comments (1)

// SEARCH

What are you searching for....?

// SUBSCRIBE

Subscribe to us on youtube for updates of our videos first on youtube.

// SUBSCRIBE

To receive updates on the latest news, tutorials and special offers, subscribe to our email newsletter today!

// CATEGORIES

x
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Privacy Policy That's Fine