Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
dslab09

dslab09

Ratings: (0)|Views: 23|Likes:
Published by kschandra1610

More info:

Published by: kschandra1610 on Jan 14, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

01/14/2011

pdf

text

original

 
DATA STRUCTURESUSING C++
Write a program for stack operation using arrays.
#include<iostream.h>#include<conio.h>int top=0;int i;class abc{int stack[5],item; public:void push();void pop();void dis();};void abc::push(){if(top==5){cout<<"Stack is overflow";}else{cout<<"Enter item\n";cin>>item;top++;stack[top]=item;dis();}}void abc::pop(){if(top==0)cout<<"stack is underflow";else{item=stack[top];cout<<"deleted elemented is "<<item;top--;dis();}}
 
DATA STRUCTURESUSING C++
 void abc::dis(){cout<<"elements in the stack are...";for(i=0;i<=top;i++)cout<<stack[i];}void main(){abc a;clrscr();int ch;do{cout<<"\n 1.push()";cout<<"\n 2.pop()";cout<<"\n 3.exit()";cout<<"Enter choice";cin>>ch;switch(ch){case 1:a.push(); break;case 2:a.pop();}}while(ch!=3);}
 
DATA STRUCTURESUSING C++OUTPUT:
 1.push()2.pop()3.exit()Enter choice 1Enter item 1Elements in the stack are…1Enter choice 1Enter item 2Element in the stack are …1 2Enter choice 3

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->