This linked list code isn't printing the data; please help
#include<iostream> using namespace std; struct node{ public: int data; struct node *next; }; void print(node *temp,node *head) { temp = head; while(temp != NULL) { cout<<temp->data; temp = temp->next; } } int main() { node *head; node *current; node *temp; int logic; cin>>logic; head = 0; while(logic) { current = new node(); cin>>current->data; if(head == NULL) { head = current = temp; } else { temp->next = current; temp = current; } cout<<"Do you want to continue"; cin>>logic; } print(head,temp); return 0; }