Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class stack
- {
- int top;
- public:
- int arr[500];
- stack()
- {
- top=-1;
- }
- void push(int);
- };
- void stack::push(int item)
- {
- arr[top++]=item; //problem here
- cout<<"n"<<item<<"pushed in stack";
- cout<<"n top value is"<<top;
- }
- int main()
- {
- stack s;
- s.push(12);
- s.push(19);
- s.push(31);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement