티스토리 뷰

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);
        }
    }
}
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함