template <class ItemType>

struct NodeType{


ItemType info;

NodeType* next;

};

template <class ItemType>

class StackType{

public:

StackType();

~StackType() const;

bool IsEmpty() const;

bool IsFull() const;

void push(ItemType jinsu, ItemType jungsu);

void pop();

private:

struct NodeType * topPtr;

};

template <class ItemType>

StackType::StackType()

{

topPtr->info = NULL;

}

template <class ItemType>

StackType::~StackType() const

{

NodeType* tempPtr;

while (topPtr != NULL)

{

tempPtr = topPtr;

topPtr = topPtr->next;

delete tempPtr;

}

}

template <class ItemType>

bool StackType::IsEmpty() const

{

if (topPtr == NULL)

return true;

else

return false;

}

template <class ItemType>

bool StackType::IsFull() const

{

NodeType* location;

try

{

location = new NodeType;

// new 연산자가 메모리 할당에 실패했을 경우, std::bad_alloc Exception을 throw

delete location;

return false;

}

catch (std::bad_alloc exception)

{

return true;

}

}

template <class ItemType>

void StackType::push(ItemType jinsu, ItemType jungsu)

{

if (IsFull() const == true)

{

cout << Stack is Full << endl;

}

else{

while (jungsu > 0){

NodeType * location;

location = new  NodeType;

location->info = jungsu%jinsu;

jungsu = jungsu / jinsu;

location->next = topPtr;

topPtr = location;

}

break;

}

}


vs2013으로 짜는데 NodeType에 뭐 빨간줄도안뜨는데 어디 소속인지도안뜨고...

메소드 만들때 사용할수있는 목록도안뜨고..(ex: void StackType::할때 사용할수 잇는 함수 뜨는데 그것도안뜨고;;)