c++ stack

♪C++/소스 2018. 9. 19. 01:56

#include<iostream>

using namespace::std;


template<typename T>

class Stack

{

T arr[5];

int index;

int front;

public:

Stack() : index(0)  {};

void Push(T num) 

{

arr[index++] = num;

}

void Pop()

{

cout << arr[--index] << endl;

}

void Empty()

{


}

};


int main()

{

Stack<int> st;


st.Push(10);

st.Push(20);

st.Push(30);


st.Pop();

st.Pop();

st.Pop();



}

'♪C++ > 소스' 카테고리의 다른 글

c++ oop프로젝트 8장  (0) 2018.09.18
열혈강의 3장 연습문제 3-1 3-2  (0) 2017.11.10
성우 1장 OOP 단계별 프로젝트  (0) 2017.10.09