#include using namespace std; class node{ public: int data; node* next; }; node*start=NULL; void create(int n) { node*newn; node*temp; for(int i=0;i>newn->data; newn->next=NULL; if(start==NULL){ start=newn; temp=start; } else{ temp->next=newn; temp=temp->next; } } } void first(){ node*newn=new node; int a; cout<<"Enter the data u want to insert at the first place:"; cin>>a; newn->data=a; newn->next=start; start=newn; } void last(){ node*newn=new node; int b; cout<<"Enter the value you want to insert at the last place:"; cin>>b; newn->data=b; newn->next=NULL; node*temp=start; while(temp->next!=NULL){ temp=temp->next; } temp->next=newn; } void middle(){ node*newn=new node; int c; int pos; cout<<"Enter position: "; cin>>pos; cout<<"enter the data you want to insert:"; cin>>c; newn->data=c; node*temp=start; for(int i=1;inext; } newn->next=temp->next; temp->next=newn; } void display(){ node*temp=start; while(temp!=NULL){ cout<data<<" "<next<next; } } int main(){ int n; cout<<"enter how many data you want to see:"; cin>>n; create(n); display(); first(); display(); last(); display(); middle(); display(); }