제목 그대로 스택과 큐를 사용하는 간단한 소스코드입니다.
#include#include #include using namespace std; int main() { cout << "-----------------Stack-----------------" << endl; cout << endl; stack st; st.push(1); st.push(2); st.push(3); int count = st.size(); for(int i=0; i < count; i++){ cout << st.top() << endl; st.pop(); } cout << endl; cout << endl; cout << "-----------------Queue-----------------" << endl; cout << endl; queue qu; qu.push(1); qu.push(2); qu.push(3); count = qu.size(); for(int i=0; i < count; i++){ cout << qu.front() << endl; qu.pop(); } return 0; }
'Programming Language > C / C++ for Windows' 카테고리의 다른 글
| [C++0x] Visual Studio 2010에 포함된 C++0x (0) | 2010/04/29 |
|---|---|
| [STL] Stack과 Queue 사용법 (0) | 2009/10/01 |