What will be the output of the following C++ code?
#include <iostream>
#include <list>
#include <queue>
using namespace std;
int main()
{
queue<char> q;
q.push('a');
q.push('b');
q.push('c');
cout << q.front();
q.pop();
cout << q.front();
q.pop();
cout << q.front();
q.pop();
}
#include <iostream>
#include <list>
#include <queue>
using namespace std;
int main()
{
queue<char> q;
q.push('a');
q.push('b');
q.push('c');
cout << q.front();
q.pop();
cout << q.front();
q.pop();
cout << q.front();
q.pop();
}
A. ab
B. abc
C. a
D. error
Answer: Option B
Join The Discussion