#include "stdafx.h"
#include<iostream>
using namespace std;
#define MAXSTACK 10
typedef int StackEntry;
typedef struct node {
StackEntry entry[MAXSTACK];
int top;
}SeqStack;
typedef enum Status {
success, fail, fatal, rangeerror, overflow
}Status;
SeqStack * init_SeqStack() {
SeqStack *s;
s = (SeqStack*)malloc(sizeof(SeqStack));
s->top = -1;
return s;
}
int Empty_SeqStack(SeqStack s) {
if (s.top == -1)return 1;
else return 0;
}
int Push_SeqStack(SeqStack *s, StackEntry elem) {
if (s->top == MAXSTACK - 1) return 0;
else {
s->top++;
s->entry[s->top] = elem;
return 1;
}
}
int Pop_SeqStack(SeqStack *s, StackEntry *elem) {
if (s->top == -1)return 0;
else {
*elem = s->entry[s->top];
s->top--;
return 1;
}
}
StackEntry Top_SeqStack(SeqStack *s) {
if (s->top == -1)return 0;
else {
return s->entry[s->top];
}
}
int main() {
SeqStack * s = init_SeqStack();
int num;
for (int i = 0; i < MAXSTACK - 1; i++) {
cin >> num;
Push_SeqStack(s, num);
}
StackEntry elem;
Pop_SeqStack(s, &elem);
cout << elem << endl;
cout << Top_SeqStack(s) << endl;
system("pause");
return EXIT_SUCCESS;
}