Skip to content

sdad0o/Stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

#include using namespace std; template class stack { private: type* element; int top, size; public: stack(int size) { element = new type[size]; top = -1; this->size = size; } bool IsFull() { return (top == size - 1); } bool IsEmpty() { return(top == -1); } int GetSize() { return size; } void push(type e) { if (IsFull()) { cout << " STACK IS FULL !!\t"; assert(0); } ++top; element[top] = e; } type pop() { if (IsEmpty()) { cout << " STACK IS EMPTY !! \t"; assert(0); } return element[--top]; } type getTop() { if (IsEmpty()) { cout << " STACK IS EMPTY !! \t"; assert(0); } return element[top]; } ~stack() { delete[]element; } }; int main() { return 0; }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published