~cpp #include<stdio.h> int stack[5]={0,}; int index =0; int top = 4; int bottom = 0; void push(int num) { if(stack[top] != '\0') { printf("만땅.\n"); } else { stack[index++] =num; } } void pop() { if(stack[bottom] == '\0') { printf("더이상지울것이없습니다.\n"); } else { stack[--index] = '\0'; } } void print() { for(int i=4;i>=0;i--) { printf("[%d]\n",stack[i]); } } void main() { push(1); push(2); push(3); pop(); pop(); pop(); pop(); pop(); push(4); push(5); push(6); print(); }