diff --git a/cpp/stackcpp.cpp b/cpp/stackcpp.cpp index 17086cd..96859db 100644 --- a/cpp/stackcpp.cpp +++ b/cpp/stackcpp.cpp @@ -1,76 +1,53 @@ +//stackArray.cpp +//a program that shows Arrays as class data members + + #include -#include using namespace std; -class Stack{ - int top,totalSize; - int *ptr; - public: - Stack(int totalSize){ - this->totalSize=totalSize; - this->top=-1; - ptr=new int[totalSize]; - } - - void push(int n){ - if(!isFull()){ - top++; - ptr[top]=n; - } - else{ - cout<<"Stack overFlow"<