PhoneBook Source Code using Data Structure_C
PhoneBook Source Code using Data Structure_C
h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>
struct list
char name[40];
char num[20];
char gmail[40];
char fb[40];
add* next;
};
int i=1,size=0;
add* temp=(add*)malloc(sizeof(add));
gets(temp->name);
system("cls");
gets(temp->name);
system("cls");
gets(temp->num);
system("cls");
printf("\n\n\n\t\t\tGmail id : ");
gets(temp->gmail);
system("cls");
gets(temp->fb);
system("cls");
temp->next = NULL;
size++;
if(size == 5)
system("cls");
return;
else
if(*head == NULL)
*head = temp;
system("cls");
printf("\n\n\t\t\t\t\tDone!!!\n\n");
return;
else
add* p = *head;
while(p->next != NULL)
p = p->next;
}
p->next = temp;
system("cls");
printf("\n\t\t\t\t\tDone!!!\n\n");
return;
void Search(add*head)
char ch[40];
gets(ch);
system("cls");
gets(ch);
system("cls");
if(head == NULL)
system("cls");
return;
else
add*p = head;
while(p != NULL)
if(strcmp((p->name),ch) == 0)
system("cls");
printf("\n\t\t\t%s",p->name);
printf("\n\t\t-------------------------");
printf("\n\t\tNumber : %s",p->num);
printf("\n\t\tGmail ID : %s",p->gmail);
return;
p = p->next;
system("cls");
char ch[40];
gets(ch);
system("cls");
gets(ch);
system("cls");
if(*head == NULL)
system("cls");
return;
else
{
if(strcmp(((*head)->name),ch) == 0)
add*p=*head;
*head = (*head)->next;
free(p);
printf("\n\t\t\t\t\tDone!!!\n\n\n\n");
return;
else
add*p = *head;
while(p->next != NULL)
if(strcmp((p->next->name),ch) == 0)
p->next = p->next->next;
size--;
return;
p = p->next;
system("cls");
printf("\n\t\t\t\t\tInvalid Contact!!!\n\n");
if(head == NULL)
{
system("cls");
return;
else
add*p = head;
while(p != NULL)
printf("\n\t\t\t\t%d.%c%s",i,32,p->name);
printf("\n\t\t\t-------------------------");
printf("\n\t\t\tNumber : %s",p->num);
printf("\n\t\t\tGmail ID : %s",p->gmail);
p = p->next;
i++;
i=1;
return;
void main()
add* head=NULL;
char c[40];
mainhome:
system("cls");
printf("\n\t\
t|!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!|");
printf("\n\t\t| !!!!!!!!!!!!!!!!!!!!!!!!!!!!
|");
printf("\n\t\t| !!!!!!!!!!!!!!!!!!!!!!!!!!!!
|");
printf("\n\t\
t|!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!|\n\n\n");
while(1)
printf("\n\n\t\t\t\t\t\tMenu");
printf("\n\t\t\t-------------------------------------------------");
printf("\n\t\t\t-1)Quit");
int ch;
scanf("%d",&ch);
if(ch == -1)
break;
else
switch(ch)
case 1 :system("cls");
Insert(&head);
break;
case 2 :system("cls");
Delete(&head);
break;
case 3 :system("cls");
Display(head);
break;
case 4 :system("cls");
Search(head);
break;
break;