if you can help please text me @ Click Here
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
void enter();
void display();
void search();
void del();
int hushsearch(unsigned long long int);
struct st
{
int year;
char name[50];
unsigned long long int phnum,regnum;
struct st *next,*prev;
};
struct st *home=NULL,*tmp1,*tmp2,*tmp3;
void main()
{
int i,j,a,n;
clrscr();
printf("\t\t***STUDENT DATA BASE***\n Enter 1 to continue or enter 0 to exit\nYour option: ");
scanf("%d",&a);
while(a!=0)
{
printf("Choose an option:\n1.Enter details\n2.View details\n3.Search For Details\n4.Delete details\n0. choose or enter '0' to exit\nYour option: ");
scanf("%d",a);
flushall();
switch(a)
{
case 1: enter(); break;
case 2: display(); break;
case 3: search(); break;
case 4: del(); break;
case 0: return;
default: printf("You've entered a wrong option, Kindly try again\n"); break;
//case'1': enter(); break;
//case'2': display(); break;
//case'3': search(); break;
//case'4': del(); break;
//case'0': return;
//default: printf("You've entered a wrong option, Kindly try again");
}
}
getch();
}
void enter()
{
tmp1=(struct st*)malloc(sizeof(struct st));
printf("Enter Name: ");
gets(tmp1->name);
flushall();
printf("Enter Regestration Number: ");
scanf("%l",&tmp1->regnum);
flushall();
printf("Enter year of JOINING : ");
scanf("%d",tmp1->year);
flushall();
printf("Enter Phone Number: ");
scanf("%l",tmp1->phnum);
if(home==NULL){ home=tmp1; home->next=NULL; home->prev=NULL; }
else
{
tmp2=home;
if(tmp2->next!=NULL)
tmp2=tmp2->next;
tmp2->next=tmp1;
tmp1->prev=tmp2;
tmp1->next=NULL;
}
}
void display()
{
tmp1=home;
while (tmp1->next!=NULL)
{
printf("Name: ");
puts(tmp1->name);
printf("Regestration Number: %l\nYear Of JOINING: %d\nPhone Number: %l\n",tmp1->regnum,tmp1->year,tmp1->phnum);
tmp1=tmp1->next;
}
printf("Name: ");
puts(tmp1->name);
printf("Regestration Number: %l\nYear Of JOINING: %d\nPhone Number: %l\n",tmp1->regnum,tmp1->year,tmp1->phnum);
}
void search()
{
int x;
unsigned long long int b;
printf("Enter Regestration num to search: ");
scanf("%l",b);
x=hushsearch(b);
if(x==1)
{
printf("Name: ");
puts(tmp1->name);
printf("Regestration Number: %l\nYear Of JOINING: %d\nPhone Number: %l\n",tmp1->regnum,tmp1->year,tmp1->phnum);
}
}
int hushsearch(unsigned long long int b)
{
int c=0;
tmp1=home;
if(tmp1->next!=NULL)
{
if(tmp1->regnum==b)
{
c++;
}
}
else
{
if(c==0) { printf("$$$ Details Not Found $$$"); }
}
if(c==1)
{
return(1);
}
else
{
return(0);
}
}
void del()
{
int x;
unsigned long long int b;
printf("Enter Regestration num to search: ");
scanf("%l",b);
hushsearch(b);
if(x==1)
{
if(tmp1->next!=NULL)
{
tmp2=tmp1->prev;
tmp3=tmp1->next;
tmp2->next=tmp3;
tmp3->prev=tmp2;
free(tmp1);
}
else
{
tmp2=tmp1->prev;
tmp2->next=NULL;
free(tmp1);
}
}
}
if you can help please text me @ Click Here
[Click Here](http://codepad.org/ZJN5AFCb)