Algorithm
[C#] Stack 구현하기
SweetDev
2021. 8. 4. 13:12
using System;
using System.Collections;
using System.Collections.Generic;
namespace tutoring
{
class MyStack {
static void Main(string[] args)
{
Stack stack = new Stack();
stack.Push(1);
stack.Push(2);
stack.Push(3);
stack.Push(4);
stack.Push(5);
Console.WriteLine("stack.Count: {0}", stack.Count);
Console.WriteLine();
while (stack.Count > 0)
Console.WriteLine(stack.Pop());
Console.WriteLine();
Console.WriteLine("stack.Count: {0}", stack.Count);
}
}
}