From 555c651cc96c366f00eee227076f04a756f43fff Mon Sep 17 00:00:00 2001 From: Rickey Patel Date: Sat, 11 May 2019 17:53:46 -0500 Subject: [PATCH] Added push to queue.md --- queue.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/queue.md b/queue.md index 725af108..dc9f7cce 100644 --- a/queue.md +++ b/queue.md @@ -5,7 +5,7 @@
  1. pop
  2. back
  3. -
  4. push
  5. +
  6. push
  7. size
  8. swap
  9. empty
  10. @@ -14,4 +14,24 @@
  11. queue
  12. ~queue
- \ No newline at end of file + + +# push +**Description** : push() function is used to insert an element at the back of the queue. The element is added to the queue container and the size of the queue is increased by 1. + +**Example**: +```cpp + // Empty queue + queue myqueue; + + // pushing elements into queue using push() + myqueue.push(0); + myqueue.push(1); + myqueue.push(2); + + // print contents of queue + while (!myqueue.empty()) { + cout << ' ' << myqueue.front(); + myqueue.pop(); + } +``` \ No newline at end of file