Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   queue operation (http://www.go4expert.com/forums/queue-operation-t21637/)

sathi 3Apr2010 11:08

queue operation
 
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!!!!!!!!!!!

xpi0t0s 4Apr2010 21:14

Re: queue operation
 
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?


All times are GMT +5.5. The time now is 12:11.