Advertisement
J00ker

Untitled

Mar 10th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. struct Stiva
  8. {
  9. int a[1001], 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. void Push(int x)
  23. {
  24. a[++top] = x;
  25. }
  26.  
  27. void Pop()
  28. {
  29. if(!Empty()) top--;
  30. }
  31.  
  32. int Top()
  33. {
  34. return a[top];
  35. }
  36.  
  37. };
  38.  
  39. int main()
  40. {
  41. Stiva s, s1, s2;
  42. s.Init();
  43. s1.Init();
  44. s2.Init();
  45. int n, i, x;
  46.  
  47. ifstream fin("s1.in");
  48. fin >> n;
  49. for(i = 0; i < n; i++)
  50. {
  51. fin >> x;
  52. s1.Push(x);
  53. }
  54. fin.close();
  55.  
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement