Update Queue Using Linked List.cpp

This commit is contained in:
Yang Libin 2019-08-21 09:17:20 +08:00 committed by GitHub
parent 0ab4f5f89d
commit abc0d365de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,10 +7,8 @@ struct node
node *next; node *next;
}; };
node *front, *rear; node *front, *rear;
void Enque(int x) void Enque(int x)
{ {
if (rear == NULL) if (rear == NULL)
@ -42,7 +40,8 @@ void Deque()
else else
{ {
node *t = front; node *t = front;
cout<<"\n"<<t->val<<" deleted"; cout << "\n"
<< t->val << " deleted";
front = front->next; front = front->next;
delete t; delete t;
if (front == NULL) if (front == NULL)
@ -84,9 +83,7 @@ int main()
{ {
show(); show();
} }
} } while (ch != 0);
while(ch!=0);
return 0; return 0;
} }