Code:
#include<iostream.h>
#include<conio.h>
#define size 10
class stack
{
 int stck;
 int tos;
 public:
 stack();
 void push(int x);
 int pop();
};
stack::stack()
{
cout<<"constructing stack:\n";
tos=0;
}
void stack::push(int x)
{
if(tos>=size)
  {
   cout<<"stack is full:\n";
   return;
   }
tos++;
stck[tos]=x;
}
int stack::pop()
{
int x;
if(tos==0)
   {
    cout<<"stack is empty:\n";
    return 0;
    }
   x=stck[tos];
   tos--;
   return x;
}
int main()
{
stack s1,s2;
int i,tos;
clrscr();
cout<<"after push operation:\n";
for(i=0;i<=tos;i++)
  {
   s1.push(i);
   s2.push(i);
   }
cout<<"after pop operation:\n";
for(i=tos;i>=0;i--)
       {
             s1.pop();
            s2.pop();
       }
getch();
return 0;
}
this is my final code now...there is no compiling error
but it is still not running properly.when i run this it displays in the whole screen only 1 msg
that "stack is full"and keeps on displaying that,
why is that happening? now /?there is no compiling error
but it is not running well...and also
it is not taking any value from the user to push or pop...
what do i do?now/?what i want to do in this code is actually
i want the user to push some values of his choice into a stack
and show the push operation and after that perform the pop operation
for that stack and display it.
: : but it is not doing that,so what r the necessary changes that
i need to make in my code to make it happen..please help me out here,i really don't have a clue what to do?any kind of help would be much appreciated.