I'm pretty new to coding, could anyone please help me initialize a user define array in class stack. i have referred material online but don't know what needs to be done still...
this is a program to implement stack using array.
#include <iostream>
using namespace std;
class stack
{
public:
int stack[len], len, top=-1; // var len will store user defined value for array size
bool isEmpty()
{
if(top<=-1)
return 1;
else
return 0;
}
bool isFull()
{
if(top>=len-1)
return 1;
else
return 0;
}
// other push pop stackTop and display functions;
};
int main()
{
int ch, val;
stack s1;
cout<<"Enter the stack length: ";
cin>>len;
// using do while for menu-driven prg to seek the stack operations
return 0;
}