#include<iostream>
#include<conio.h>
using namespace std;
struct Node{
int data;
struct Node *next;
};
Node * top =NULL;
void push(int newdata)
{
if(top==NULL){
Node * node = new Node;
node->data = newdata;
node->next=NULL;
top=node;
}
else{
Node * node = new Node;
node->data = newdata;
node->next = top;
top=node;
}
}
void pop(){
if(top->next==NULL){
Node * node = new Node;
node = top;
delete node;
top = NULL;
}
else
{
Node * node = new Node;
node = top;
top = top->next;
delete node;
}
}
int size(){
int count;
while(top==NULL){
count++;
top= top->next;
}
return count;
}
int topdata(){
int newdata;
newdata = top->data;
return newdata;
}
bool empty()
{
if(top==NULL)
return true;
else
return false;
}
int main(){
push(12);
cout<<topdata()<<endl;
system("pause");
return 0;
}