-
Notifications
You must be signed in to change notification settings - Fork 0
/
queue.cpp
24 lines (20 loc) · 897 Bytes
/
queue.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <queue>
using namespace std;
int main ()
{
queue <string> names; /* Declare a queue */
names.push ("Danny"); /* Add some values to the queue */
names.push ("Kayleigh"); /* Much like vectors */
names.push ("Joe"); /* This basically does the same thing */
cout << "There are currently " << names.size () << " people in the queue" << endl
<< "The person at the front of the queue is " << names.front () << endl
<< "The person at the back of the queue is " << names.back () << endl << endl;
cout << names.front () << " has been served!" << endl;
names.pop ();
cout << "There are currently " << names.size () << " people in the queue" << endl
<< "The person at the front of the queue is " << names.front () << endl
<< names.back () << " is still at the back!" << endl;
cin.get ();
return 0;
}