1
17kviews
Write a program to implement STACK ADT using array

Mumbai University > Information Technology > Sem 3 > Data Structure and Algorithm analysis

Marks: 10 M

Year: May 2015

1 Answer
0
575views

Program:

#include<iostream>
#include<conio.h>
using namespace std;
class Stack
{
    int stk[10];
    int top;
    public:
    Stack()
    {
    top=-1; 
    }

//This funtion is used to push an elemnt into stack
    void push(int x)
    {
        if(isFull())
        {
            cout <<"Stack is full";
            return;
        }
        top++;
        stk[top]=x;
        cout <<"Inserted Element:"<<" "<<x;
    }

    //This functionn is …

Create a free account to keep reading this post.

and 3 others joined a min ago.

Please log in to add an answer.