Why i am getting first node twice?

#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???

hello @Ravi-Kant-1580620005429648

please share ur code using cb ide

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.