stack.push(), stack.top(), stack.pop()
// whoIsHOO
// C++에 빠지다
#include <iostream>
#include <stack>
using namespace std;
int main()
{
stack<int> hooStack;
for (int i = 0; i < 10; i++)
{
hooStack.push(i);
}
cout << hooStack.top() << endl;
hooStack.pop();
cout << hooStack.top() << endl;
return 0;
}
9
8
예제 코드를 활용하는 방법!!
1. 예제 코드를 보고 직접 컴파일을 해보세요.
2. 예제 코드에서 모르는 부분이 있다면 알려주세요.
3. Flowcharts를 직접 그려보세요.
728x90
'Programming Languages > C and C++' 카테고리의 다른 글
stack functions(stack.push(), stack.top(), stack.pop()) (0) | 2020.05.03 |
---|---|
[C++] Queue(큐)란? (0) | 2020.05.02 |
Stack(스택)이란? (0) | 2020.04.30 |
[Example Codes]make_heap(v.begin(), v.end()), v.push_back(), push_heap(v.begin(), v.end()), pop_heap(v.begin(), v.end()) (0) | 2020.04.30 |
heap sort(힙 정렬) Full Binary Trees vs Complete Binary Trees (0) | 2020.04.29 |
댓글