queue operation

sathi's Avatar, Join Date: Nov 2009
Newbie Member
Code:
#include<iostream.h>
#include<conio.h>
struct node
{
int data;
char node.*link;
};
void main()
{
node,*front,*temp,*cur;
int ch;
front=NULL;
lab:
clrscr();
cout<<"queue operation"<<endl;
cout<<"1.insert \n 2.delete \n 3.display"<<endl;
cout<<"\n Enter your choice"<<endl;
cin<<ch;
switch(ch);
{
case 1:
{
temp=new.node;
cout<<"\n Enter the elements to be inserted"<<endl;
cin>>temp=data;
if(front==NULL)
{
temp->link=front;

front=temp;
cout<<"\n Inserted \n front="<<endl;
}
else
{
cur=front;
while (cur->link!=null)
cur=cur->link;
temp->link=NULL;
cur->link=temp;
}
break;
}
case 2:
{
if(front==NULL)
cout<<"\n QUEUE EMPTY:"<<endl;
else
{
cout<<"\n The elements deleted is:"<<front->data;
front=front->link;
}
break;
}
case 3:
{
if(front==NULL)
cout<<"\n QUEUE EMPTY:"<<endl;
else
{
cout<<"\n content is:"<<endl;
for(cur=front;cur!=NULL;cur=cur->link)
cout<<cul->data<<endl;

}
break;
}
default;
{
cout<<"\n Enter from 1 to 3"<<endl;
}
break;
}
cout<<"\n Do you want to continue:(y>o)";
cin>>ch;
if(ch!=0)
goto lab;
getch();
}
explain the concept of these program and important command line??

urgent anyone help!!!!!!!!!!!

Last edited by shabbir; 3Apr2010 at 21:10.. Reason: Code blocks
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
Well, what do you think it does? You've already mentioned queues; could that be a hint? Are there any lines in the program that display anything? If so, what do they display, and could that be some help in determining what the program does?

The program appears to have some errors in it. Did you try compiling and running the code?