2009/10/01 00:43

제목 그대로 스택과 큐를 사용하는 간단한 소스코드입니다.

#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;
}
저작자 표시 비영리 변경 금지
Posted by 태발이