#include<iostream.h>
#include<string.h>
struct node
{
node*next;
int data;
};
class stack
{
private:node*top;node*top2;char c;
public:
stack()
{
top=NULL;
top2=NULL;
}
void push(char c)
{
if(top==NULL)
{
top=new node;
top->data=c;
top->next=NULL;
}
else
{
node*temp=top;
temp->data=c;
temp->next=top;
top=temp;
}
}
void pop()
{
node*temp=top;
char x=temp->data;
cout<<x;
top=top->next;
delete temp;
}
};
void main()
{
stack a;
char f[10];
cout<<"enter"<<endl;
cin>>f;
for(int i=0;i<10;i++)
{
a.push(f[i]);
}
for(int j=0;j<10;j++)
{
a.pop();
}
}
hattisaeed 0 Newbie Poster
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.