//¹®Á¦ 2. ´ÙÀ½ ÇÁ·Î±×·¥ÀÇ Ãâ·ÂÀ» ¾²½Ã¿À. using System; namespace Test2 { class Stack { int[] s; int top; int pos; public Stack() { s = new int[10]; top = -1; pos = s.Length / 2; } public void push(int x) { top++; s[pos + top] = x; s[pos - top] = x; } public int pop() { s[pos + top] = 0; s[pos - top] = 0; top--; return s[top]; } public void print() { for (int i = 0; i < s.Length; i++) { if (s[i] != 0) Console.Write(s[i]); } } } class Program { static void Main(string[] args) { int[] data = { 1, 2, 3, 4, 5 }; Stack s = new Stack(); for (int i = 0; i < data.Length; i++) { s.push(data[i]); } s.pop(); s.pop(); s.print(); } } }