#include
using namespace std;
class node{
public:
int data;
node* next;
node (int d){
data =d;
next =NULL;
}
};
void insertathead(node*&head,int d){
if(head==NULL){
head=new node(d);
}
node* n=new node (d);
n->next=head;
head=n;
}
void print(node* head){
while(head!=NULL){
cout<data<<",";
head=head->next;
}
}
node* take_input(){
int d;
node* head = NULL;
while(cin>>d){
insertathead(head,d);
}
return head;
}
int main() {
node*head=take_input();
print(head);
return 0;
}
what is the error in these code???