#include #include #include using namespace std; bool check = true; struct node { char name[20]; char jobtitle[20]; int empno; char branch; node *next; }*head,*lastptr; // pointes void add() // calling { node *p; //*p pomiter p=new node; cout<<"Enter name of employ:"<name); cout<<"Enter job title of employ:"<jobtitle); cout<<"Enter Number of employ:"<>p->empno; cout<<"Enter branch of employ:"<>p->branch; p->next=NULL; if(check) //if check is true its means heads is empty and there is no node exist. { head = p; lastptr = p; check = false; } else { lastptr->next=p; lastptr=p; } cout<>e_no; prev=head; current=head; while(current->empno!=e_no) { prev=current; current=current->next; } ptr=new node; cout<<"Enter name of employ:"<name); cout<<"Enter job title of employ:"<jobtitle); cout<<"Enter Number of employ:"<>ptr->empno; cout<<"Enter branch of employ:"<>ptr->branch; prev->next=ptr; ptr->next=current->next; current->next=NULL; delete current; cout<>e_no; prev=head; current=head; while(current->empno!=e_no) { prev=current; current=current->next; } cout<<"\nname: "; puts(current->name); cout<<"\nEmp No:"; cout<empno; cout<<"\njob title:"; puts(current->jobtitle); cout<<"\nbranch:"; cout<branch; } void del() { node *ptr=NULL; node *prev=NULL; node *current=NULL; int e_no; cout<<"Enter Number to Delete:"<>e_no; prev=head; current=head; while(current->empno!=e_no) { prev=current; current=current->next; } prev->next = current->next; current->next=NULL; delete current; cout<

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

#include <conio.h>
#include <iostream>
#include <string>

using namespace std;
bool check = true;
struct node
{
char name[20];
char jobtitle[20];
int empno;
char branch;
node *next;
}*head,*lastptr; // pointes

void add() // calling
{
node *p; //*p pomiter
p=new node;
cout<<"Enter name of employ:"<<endl;
gets(p->name);

cout<<"Enter job title of employ:"<<endl;
gets(p->jobtitle);

cout<<"Enter Number of employ:"<<endl;
cin>>p->empno;

cout<<"Enter branch of employ:"<<endl;
cin>>p->branch;

p->next=NULL;

if(check) //if check is true its means heads is empty and there is no node exist.
{
head = p;
lastptr = p;
check = false;
}
else
{
lastptr->next=p;
lastptr=p;
}
cout<<endl<<"Recored Entered";

}

void modify()
{
node *ptr;
node *prev=NULL;
node *current=NULL;
int e_no;
cout<<"Enter Number to search:"<<endl;
cin>>e_no;
prev=head;
current=head;
while(current->empno!=e_no)
{
prev=current;
current=current->next;
}
ptr=new node;

cout<<"Enter name of employ:"<<endl;
gets(ptr->name);

cout<<"Enter job title of employ:"<<endl;
gets(ptr->jobtitle);

cout<<"Enter Number of employ:"<<endl;
cin>>ptr->empno;

cout<<"Enter branch of employ:"<<endl;
cin>>ptr->branch;

prev->next=ptr;
ptr->next=current->next;
current->next=NULL;
delete current;
cout<<endl<<"Recored Modified";
getch();
}
void search() //searches record of employ//
{
node *prev=NULL;
node *current=NULL;
int e_no;
cout<<"Enter Number to search:"<<endl;
cin>>e_no;
prev=head;
current=head;
while(current->empno!=e_no)
{
prev=current;
current=current->next;
}
cout<<"\nname: ";
puts(current->name);
cout<<"\nEmp No:";
cout<<current->empno;
cout<<"\njob title:";
puts(current->jobtitle);
cout<<"\nbranch:";
cout<<current->branch;

}

void del()
{
node *ptr=NULL;
node *prev=NULL;
node *current=NULL;
int e_no;
cout<<"Enter Number to Delete:"<<endl;
cin>>e_no;
prev=head;
current=head;
while(current->empno!=e_no)
{
prev=current;
current=current->next;
}
prev->next = current->next;
current->next=NULL;
delete current;
cout<<endl<<"Recored Deleted";

}

int main()
{
char x;
cout<<"\t\t Employ MANAGEMENT SYSTEM \t\t\t"<<endl;

do
{
system("cls");
cout<<"1-Press '1' to add New record:"<<endl;
cout<<"2-Press '2' to search a record:"<<endl;
cout<<"3-Press '3' to modify a record:"<<endl;
cout<<"4-Press '4' to delete a record:"<<endl;
cout<<"5-Press '5' to exit:"<<endl;
x=getch();
if(x=='1')
{
system("cls");
add();
}
else if(x=='2')
{
system("cls");
search();
}
else if(x=='3')
{
system("cls");
modify();
}
else if(x=='4')
{
system("cls");
del();
}
else if(x=='5')
{
exit(0);
}
else
{
}
}while(x != 27);
getch();
}

 

Explain this program in detail....which functions are used in it  and why they are used explain each and everything.

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Dictionary
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education