Not show correctanswer

#include
using namespace std;
class node{
public:
int data;
nodenext;
node(int d){
data=d;
next=NULL;
}
};
int len(node
head){
int length=0;
while(head!=NULL){
head=head->next;
length++;
}
return length;
}
void insertattail(node*&head,int data){
if(head==NULL){
head=new node(data);
return;
}
node*tail=head;
while(tail->next!=NULL){
tail=tail->next;
}
tail->next=new node(data);
return;
}

void insertathead(node*&head,int data){
noden=new node(data);
n->next=head;
head=n;
}
void print(node
head){

while(head!=NULL){
    cout<<head->data<<"<-";
    head=head->next;
}

}
void insertatmiddle(node*&head,int data,int p){
if(head==NULL||p==0){
insertathead(head,data);
}
else if(p>len(head)){
insertattail(head,data);
}
else{
int jump=1;
nodetemp=head;
while(jump<=p-1){
temp=temp->next;
jump+=1;
}
node
n=new node(data);
n->next=temp->next;
temp->next=n;
}
}
void deleteathead(node*&head){
if(head==NULL){
return;
}
nodetemp=head;
head=head->next;
delete temp;
return;
}
void deleteattail(node
&head){
nodepre=NULL;
node
temp=head;
while(temp->next!=NULL){
pre=temp;
temp=temp->next;
}
delete temp;
pre->next=NULL;
return;
}
bool searchrecusive(nodehead,int key){
if(head==NULL){
return false;
}
if(head->data==key){
return true;
}
else{
return searchrecusive(head->next,key);
}
}
void builtlist(node
&head){
int data;
cin>>data;
while(data!=-1){
insertathead(head,data);
cin>>data;
}
}
istream& operator>>(istream&is,node*&head){
builtlist(head);
return is;
}
ostream& operator<<(ostream&os,node*&head){
print(head);
return os;
}
/void reverse(node&head){
nodec=head;
node
p=NULL;
noden;
while(c!=NULL){
n=c->next;
c->next=p;
p=c;
c=n;
}
head=p;
}
/
nodemiddlepoint(node&head){
if(head==NULL||head->next==NULL){
return head;
}
nodeslow=head;
node
fast=head->next;
while(fast!=NULL && fast->next!=NULL){
fast=fast->next->next;
slow=slow->next;
}
return slow;
}
nodemerge(nodea,nodeb){
if(a==NULL){
return b;
}
else if(b==NULL){
return a;
}
node
c;
if(a->data < b->data){
c=a;
c->next=merge(a->next,b);
}
else{
c=b;
c->next=merge(a,b->next);
}
return c;
}
int main() {
nodehead=NULL;
node
head2=NULL;
cin>>head>>head2;
head=merge(head,head2);
cout<<head<<endl;
print(head);
}

Please save your code on ide.codingblocks.com and then share its link.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.