Thursday, July 17, 2014

Insert Element in Stack

#include
using namespace std;
int main()
{
int a[8]={1,2,3,4},item=10,i=7;
while(a[i]=='\0')
{
i--;
}
i++;
a[i]=item;

for(i=0;i<8;i++)
{
cout<<a[i]<<endl;
}
return 0;
}

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. #include
    using namespace std;
    int main()
    {
    int a[8]={1,2,3,4},item=10,i=7;
    while(a[i]=='\0')
    {
    i--;
    }
    i++;
    a[i]=item;

    for(i=0;i<8;i++)
    {
    cout<<a[i]<<endl;
    }
    return 0;
    }

    ReplyDelete