From 0bf182362ac8fe0f11f45bacbb0f9b1639792364 Mon Sep 17 00:00:00 2001 From: Karthiks08 <73209015+Karthiks08@users.noreply.github.com> Date: Thu, 22 Oct 2020 10:45:33 +0530 Subject: [PATCH] this is updated program plz check it out --- cpp/stackcpp.cpp | 111 +++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 67 deletions(-) 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"<