#include<queue> using namespace std; int main(void) { queue<char> Queue; Queue.push('A'); Queue.push('B'); Queue.push('C'); cout << "Queue Size : " << Queue.size() << endl; cout << "Queue Items" << endl; while( ! Queue.empty() ) { cout << Queue.front() << endl; Queue.pop(); } return 0; }
#include<iostream> #include<queue> using namespace std; int main(){ queue<int> Q; cout << "size of queue: " << Q.size() << endl; cout << "Is queue empty?: " << Q.empty() << endl<<endl; Q.push(1); Q.push(2); Q.push(3); cout << "size of queue: " << Q.size() << endl; cout << "Is queue empty?: " << Q.empty() << endl << endl; cout << "Front of queue: " << Q.front() << endl; cout << "Back of queue: " << Q.back() << endl; cout << "size of queue: " << Q.size() << endl << endl; Q.pop(); cout << "size of queue after popped: " << Q.size() << endl; cout << "Front of queue: " << Q.front() << endl; return 0; }
Designed by sketchbooks.co.kr / sketchbook5 board skin
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5