示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        // 제네틱 사용하지 않았을때 스택을 사용하는 코드

        int       size   = 5;
        CStackInt istack = new CStackInt(size);


        for (int i = 0; i < 7; i++)
        {
            if (!istack.IsFull())
            {
                istack.Push(i);
            }
            else
            {
                Debug.Log("스택이 꽉 찼습니다. [저장 실패 : " + i + "]");
            }
        }

        while (!istack.IsEmpty())
        {
            Debug.Log(istack.Pop());
        }
    }
示例#2
0
    // Start is called before the first frame update
    void Start()
    {
        // 제네틱 사용하지 않았을때 스택을 사용하는 코드

        int       size   = 5;
        CStackInt istack = new CStackInt(size);


        for (int i = 0; i < 7; i++)
        {
            if (!istack.IsFull())
            {
                istack.Push(i);
            }
            else
            {
                Debug.Log("스택이 꽉 찼습니다. [저장 실패 : " + i + "]");
            }
        }

        while (!istack.IsEmpty())
        {
            Debug.Log(istack.Pop());
        }



        CStackFloat fstack = new CStackFloat(size);

        for (int i = 0; i < 7; i++)
        {
            if (!fstack.IsFull())
            {
                fstack.Push(i * 1.2f);
            }
            else
            {
                Debug.Log("스택이 꽉 찼습니다. [저장 실패 : " + i + "]");
            }
        }

        while (!fstack.IsEmpty())
        {
            Debug.Log(fstack.Pop());
        }



        CStackString sstack = new CStackString(size);

        for (int i = 0; i < 7; i++)
        {
            if (!sstack.IsFull())
            {
                sstack.Push(i + "번");
            }
            else
            {
                Debug.Log("스택이 꽉 찼습니다. [저장 실패 : " + i + "]");
            }
        }

        while (!sstack.IsEmpty())
        {
            Debug.Log(sstack.Pop());
        }
    }