Advertisement
J00ker

Untitled

Mar 3rd, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #define Nmax 1000
  3.  
  4. using namespace std;
  5.  
  6. struct Stiva
  7. {
  8. int st[Nmax];
  9. int top;
  10.  
  11. void Init()
  12. {
  13. top = -1;
  14. }
  15.  
  16. int Empty()
  17. {
  18. if(top == -1) return 1;
  19. return 0;
  20. }
  21.  
  22. int Full()
  23. {
  24. if(top == Nmax - 1) return 1;
  25. return 0;
  26. }
  27.  
  28. void Push(int x)
  29. {
  30. if(Full()) cout << "Stack Overflow!"
  31. else st[++top] = x;
  32. }
  33.  
  34. void Pop()
  35. {
  36. if(!Empty()) top--;
  37. }
  38.  
  39. int Top()
  40. {
  41. return st[top];
  42. }
  43. };
  44.  
  45. int main()
  46. {
  47.  
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement