#include <bits/stdc++.h> using namespace std; class node{ public: int d; node* next; }; void printlinkedelements(node* i) { while(i!=NULL) { cout<<i->d<<" "<<i<<"\n"; i=i->next; } } void takeinput(node* i) { while(i!=NULL) { cin>>i->d; i=i->next; } } int main() { node* head=NULL; node* second=NULL; node* third=NULL; head=new node(); second=new node(); third=new node(); head->next=second; second->next=third; third->next=NULL; takeinput(head); printlinkedelements(head); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter