Computer Science, asked by sumairadoll, 3 months ago

void add_after()
{
if (head==NULL)
{

cout<<"\n\t\tLink is empty !:"<<endl;
cout<<"\n\t\tAdd a new record Press Y or N:"<<endl;
cin>>ch;
if (ch=='Y'||ch=='y')
{
add_first();
return;
}
else
{
// exit)(1);

}
}
else
{
int val;
bool flag=false;


cout<<"\n\tEnter the ID after which you want to add a new record:"<<endl;
cin>>val;

node *temp=head;


node *p;
while(temp!=NULL)
{

// if (temp->id==val)
if(flag=true)
{


node *newer=new node ;

cout<<"\n\tEnter the Employee ID:"<<endl;
cin>>newer->id;
cout<<"\n\t\t Enter the employee Full name :"<<endl;
cin.getline(newer->name,50);
cin>>newer->name;

cout<<"\n\t\t Enter the Qualification :"<<endl;
cin.getline(newer->qua,30);
cin>>newer->qua;

cout<<"\n\t\t Enter the Address of Employee :"<<endl;
cin.getline(newer->addrs ,50);
cin>>newer->addrs;

cout<<"\n\t\t Enter the City:"<<endl;
cin.getline(newer->city,30);
cin>>newer->city;

cout<<"\n\t\t Enter the employee Job title :"<<endl;
cin.getline(newer->jobtitle,50);
cin>>newer->jobtitle;

cout<<"\n\t\tEnter the Employee the Salary:"<<endl;
cin>>newer->salry;

cout<<"\n\t\t Enter the start Date :"<<endl;
cin.getline(newer->date,30);
cin>>newer->date;



if (temp->next!=NULL)
{
newer->next=temp->next;
newer->prev=temp;
p=temp->next;
p->prev=newer;
temp->next=newer;

}
else
{
newer->next=temp->next;
newer->prev=temp;
temp->next=newer;

}
flag=true;


}
temp=temp->next;
temp=NULL;
}
if(flag==false)
{
cout<<"\n\tID is not Found! :"<<endl;

}

}
} Explain this function step by step....if you can't explain it then don't give wrong Answer​

Answers

Answered by prashudwivedi54
1

Soory dear question us not clear to me...

Similar questions