When I ran the below code in dev C++ the output is empty, Even though online compilers are doing well. Is there a specific error in my code or do I have change dev C++ settings
#include<iostream>
#include<vector>
using namespace std;
class node //node definition
{
    public:
        int data;
        node* next;
        node(int value=0)
        {
            data=value;
            
        }
};
node* insert(node* head,int data)  //node insertion 
{
    node* ins=new node(data);
    if(head==NULL)
    {
        return ins;
    }
    else
    {
        node* ptr=head;
        while(head->next!=NULL)
        head=head->next;
        
        head->next=ins;
        ins->next=NULL;
        return ptr;
    }
    
}
void print(node* head)  //printing the values of linked list
{
    while(head!=NULL)
    {
        cout<<head->data<<" ";
        head=head->next;
    }
}
int main()
{
    vector <int> a{1,2,3,6,8};
    node* list=NULL;
    for(int x:a)
    {
        list=insert(list,x);
    }
    print(list);
}

Can anyone resolve the issue?
 
     
    