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)

Recommended Answers

All 3 Replies

This is a public forum. Questions should be asked and answered in the public rather than by text. It wastes everyone's time to ask them to text you. For all I know, someone has already texted you the same help that I might give, so I would spend time answering a question someone else has already covered.

You also need to be more specific about where the error is, what the problem is, what the program should do, etc.

Also, don't assume everyone has libraries like conio.h. Are you sure you want to still use it in 2016? That's fine if you do, but realize that it won't compile for many people.

Thank you for yor reply AssertNull... :)
I just rechecked it carefully and crrected all the errors and now it works fine....
In our colege they just taught us to use conio.h to use functions like getch() so we still use it and we are just begginers for programming..
ours is KL University BTW...

It boggles my mind how so many "universities" teaching computer science are utilizing outdated compilers and tools. It is as though they have never heard of Linux and virtual machines... Best, up-to-date compilers, tools (all free) available.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.