push, pop program header file
This is a lesson on my programming class.If anyone needs help in there programming problems and they think this is the answer. Then feel free to cpy the code
#include
using namespace std;
class stack
{
public:
stack(int size)
{
max_size=size;
item= new int[max_size];
top=-1;
}
~stack()
{
delete[] item;
}
void show()
{
for(int x=top;x>=0;x--)
cout<
}
void push(int value)
{
if(top+1 {top++;
item[top]=value;}
}
int pop()
{
if (top>-1)
return (item[top--]);
}
private:
int *item;
int max_size;
int top;
};
#include
using namespace std;
class stack
{
public:
stack(int size)
{
max_size=size;
item= new int[max_size];
top=-1;
}
~stack()
{
delete[] item;
}
void show()
{
for(int x=top;x>=0;x--)
cout<
}
void push(int value)
{
if(top+1
item[top]=value;}
}
int pop()
{
if (top>-1)
return (item[top--]);
}
private:
int *item;
int max_size;
int top;
};
Post a Comment