Struct Stu (Int A Stu Next )
Struct Stu (Int A Stu Next )
struct stu
{
int a;
stu *next;
};
void main()
{
clrscr();
stu *front,*rear;
intval,ch,i;
front=rear=NULL;
for(i=0;i<2;i++)
{
cout<<"enter the number to be inserted : ";
cin>>val;
rear=insert(rear,val);
if(front==NULL)
front=rear;
}
do
{
cout<<"\n\nmenu\n1.insert\n2.delete\n3.traverse\n4.
quit\nenter your choice : ";
cin>>ch;
switch(ch)
{
case 1 : cout<<"enter the number to be inserted : ";
cin>>val;
rear=insert(rear,val);
if(front==NULL)
front=rear;
break;
case 2 : front=remove(front,val);
cout<<"\n the deleted value is : "<<val;
if(front==NULL)
rear=front;
break;
case 3 : show(front);
break;
}
}
while(ch!=4);
getch();
}
menu
1.insert
2.delete
3.traverse
4.quit
enter your choice : 3
the queue is...
4678
menu
1.insert
2.delete
3.traverse
4.quit
enter your choice : 2
the deleted value is : 4
menu
1.insert
2.delete
3.traverse
4.quit
enter your choice : 3
the queue is...
678
menu
1.insert
2.delete
3.traverse
4.quit
enter your choice :