Members BookmarksPolls Fresher Jobs Funny Pictures MCA Projects New Member FAQ  



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

Advertisements


website counter



Program for implementation of MULTI STACK


Posted Date: 14 Dec 2007    Resource Type: Articles/Knowledge Sharing    Category: Education

Posted By: Jagadeesan. D       Member Level: Silver
Rating:     Points: 4



MULTI STACK

#include
#include
#include
#define Maxsize 10
template
class multi{
private:
T ele[Maxsize];
int top;
public:
multi() {
top=0;
}
void push(T);
void pop();
void display();
};
template
void multi::push(T num){
if(top==(Maxsize-1))
cout<<"Stack is full";
else
{
top++;
ele[top]=num;
}
}
template
void multi::pop(){
if(top==0)
cout<<"Stack is Empty";
else
top--;
}
template
void multi::display(){
for(int i=1;i<=top;i++)
cout<}
void main(){
clrscr();
multi s1,s2;
int choice=0,ch=0,num;
do {
cout<<"\n1.PUSH";
cout<<"\n2.POP";
cout<<"\n3.DISPLAY";
cout<<"\n4.EXIT";
cout<<"\nEnter ur choice\t";
cin>>choice;
switch(choice) {
case 1: cout<<"\nEnter the element:\t";
cin>>num;
cout<<"\n1.STACK 1\n";
cout<<"\n2.STACK 2\n";
cout<<"\nEnter ur Choice:\t";
cin>>ch;
switch(ch) {
case 1: s1.push(num);
break;
case 2: s2.push(num);
}
break;
case 2:cout<<"\n1.STACK 1\n";
cout<<"\n2.STACK 2\n";
cout<<"\nEnter ur Choice:\t";
cin>>ch;
switch(ch) {
case 1: s1.pop();
break;
case 2: s2.pop();
}
break;
case 3: cout<<"\n1.STACK 1\n";
cout<<"\n2.STACK 2\n";
cout<<"\nEnter ur Choice:\t";
cin>>ch;
switch(ch) {
case 1: s1.display();
break;
case 2: s2.display();

}
break;
case 4: return;
}
}
while(choice<=3);
getch();
}




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Program for implementation of DEPTH FIRST SEARCH
Previous Resource: Syllabus for Academic Year 2007-2008 for B.Tech./MBA/MCA/B.Pharmacy.
Return to Discussion Resource Index
Post New Resource
Category: Education


Post resources and earn money!
 
Related Resources


Contact Us    Privacy Policy    Terms Of Use   

SpiderWorks Technologies Pvt Ltd. 2006 - 2007 All Rights Reserved.