Question OF merge sorted Linked lists

can you help me with bug in my code?

#include
using namespace std;

class node{
public:
int data;
node* next;

node( int data){
this->data=data;
next=NULL;
}

};

node* takeinput( int elements){
int data;

node* head=NULL;
node* tail=NULL;
int i=1;
int element=elements;
while(i<=element){
cin>>data;
node* newnode= new node(data);
if(head==NULL){
head= newnode;
tail= newnode;
}
else{
tail->next=newnode;
tail=tail->next;
}

i++;
}
return head;
}

node* MergeLL( node a,node b){

node* result = NULL;
if (a == NULL)
return(b);
else if (b == NULL)
return(a);

if (a->data <= b->data)
{
    result = a;
    result->next = MergeLL(a->next, b);
}
else
{
    result = b;
    result->next = MergeLL(a, b->next);
}
return(result);

}
void printLL(node* resultfinal){
node*temp=resultfinal;
while(temp!=NULL){
cout<data<<" ";
temp=temp->next;

}
}

int main(){
int elements;
//cout<<“enter no of elements for list 1”<<endl;
cin>>elements;
node* head1=takeinput(elements);
// cout<<“ente no of elem for ll 2”<<endl;
cin>>elements;
nodehead2=takeinput(elements);
node
resultfinal= MergeLL( head1,head2);
printLL(resultfinal);
}

can you please save your code in codingblocks ide and send me the link… its difficult to analyze such un-indented code.

thanks

always try to share the code in some ide(ide.codingblocks.com) . the code gets distorted in this window.
updated code: https://ide.codingblocks.com/s/212038

i did not see any error. sometimes hackerblocks is just unresponsive. try submitting multiple times.

thanks
please rate and resolve if satisfied.

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.