Advertisement
karbaev

stl-queue

Mar 4th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main ()
  8. {
  9.     queue <string> names; /* Declare a queue */
  10.     names.push ("Ben"); /* Add some values to the queue */
  11.     names.push ("Erin");
  12.     names.push ("Dan");
  13.     cout << names.size ()<<" names added" << endl;
  14.     cout << "Now serving: "
  15.          << names.front () << endl << endl;
  16.     names.pop ();
  17.     cout << "There are currently " << names.size ()
  18.          << " people in the queue. "
  19.          << "\nThe next person in the queue is "
  20.          << names.front () << "." << endl << endl
  21.  
  22.          << names.back () << " is the last person in the queue."
  23.          << endl;
  24.  
  25.     cin.get ();
  26.     return 0;
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement