ݺߣ

ݺߣShare a Scribd company logo
Personal Information
Organization / Workplace
Phayao
Occupation
Ȩกสำรวจึϸวแพนโดร่า
About
#include<iostream.h>#include<stdio.h>class linklist{struct node{ int data;node *next;};node *first,*n;public:linklist(){ first = new node;first->data = 0;first->next = NULL;}void addnode(int i){ n = new node;n->data = i;if(first->next==NULL)n->next = NULL;elsen->next = first->next;first->next = n;}void remove(){if(first->next!=NULL){ node *temp;temp=first->next;first->next = temp->next;delete temp;}elsecout<<"Linklist Empty\n";}void display(){ node *p;for(p=first->next;p!=NULL;p=p->next)printf("data = %d\n",p->data);}};void main(){ linklist l1;int option=0,data;while(option!=4){cout<<"-----MENU------\n" ;cout<<"1.Add node\n";cout<<"2.Delete node\n";cout<<"3.Display data\n";cout<<"4.Exit\n";c