1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

queue operation

Discussion in 'C++' started by sathi, Apr 3, 2010.

  1. sathi

    sathi New Member

    Joined:
    Nov 23, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    current job is student in karpagam
    Location:
    coimbatore
    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 a moderator: Apr 3, 2010
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    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?
     

Share This Page