되는대로 살자

stack 본문

2009~2014/C/C++

stack

malu 2011. 5. 14. 10:30

#include <stdio.h>
#include <stack>
using namespace std;
int main()
{
 int k;
 stack<int> i;
 for(k=0;k<=100;k++)
  i.push(k);
 for(k=0;k<=100;k++)
 {
  printf("%d",i.top());
  i.pop();
  if(i.empty())
   printf("error");

 }
}