Computer Science, asked by radha6898, 11 months ago

Write a function in C++ to perform Insert: operation on a dynamically
allocated Queue containing Passenger details as given in the following
definition of NODE.
struct NODE
long Pno;//passenger Number
char Pname[20]; //passenger Name
NODE *Link.;​

Answers

Answered by silvershades54
3

Explanation:

Node. Any system or device connected to a network is also called a node.

A node can also refer to a leaf, which is a folder or file on your hard disk. In physics, a node, or nodal point, is a point of minimum displacement or where multiple waves converge, creating a net amplitude of zero.

hope this helps ✌️❤️✌️

Answered by TheEmma
3

Answer:

Explanation:

allocated Queue where each

node contains a name (of type string) as data.

Assume the following definition of THENODE for the same.

struct THENODE

{

char Name[20];

THENODE *Link;

};

Solution:

struct THENODE

{

char Name[20];

THENODE *Link;

};

class Queue

{

THENODE *front,*rear;

public:

Queue( )

{ front = rear = NULL; }

void Insert( );

void Delete( );

void Display( );

};

void Queue::Insert( )

{

THENODE *ptr;

ptr=new THENODE;

if(ptr= = NULL)

{

cout<<”\nNo memory to create a new node….”;

exit(1);

}

cout<<”\nEnter the name….”;

Name);gets(ptr

Link=NULL;ptr

if(rear= = NULL)

front=rear=ptr;

else

{

Link=ptr;rear

rear=ptr;

}

Similar questions