output is not coming
#include
using namespace std;
class node{
public:
int data;
node *next;
node(int d){
data=d;
next=NULL;
}
};
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;12
}
void buildInput(node *&head){
int data;
cin>>data;
while(data!=-1){
insertAtTail(head,data);
cin>>data;
}
}
void print(node *head){
while(head!=NULL){
cout<data<<"->";
head=head->next;
}
cout<<endl;
}
istream& operator>>(istream &is, node head){
buildInput(head);
return is;
}
ostream& operator<<(ostream &os, nodehead){
print(head);
return os;
}
int main(){
node *head1=NULL;
node *head2=NULL;
/buildInput(head);
print(head);/
cin>>head1>>head2;
cout<<head1<<endl<<head2;
return 0;
}