Advertisement
heian

Untitled

Jun 21st, 2019
95
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.  
  3. using namespace std;
  4.  
  5. //ooperatii stiva
  6. int st[1001];
  7. int top=-1;
  8.  
  9. void Init()
  10. {
  11. top=-1;
  12. }
  13.  
  14. void Push(int x)
  15. {
  16. st[++top]=x;
  17. }
  18.  
  19. void Pop()
  20. {
  21. top--;
  22. }
  23.  
  24. bool Empty()
  25. {
  26. return top<0;
  27. }
  28.  
  29. int Top()
  30. {
  31. if(!Empty())
  32. return st[top];
  33. cout<<"Stiva este vida!";
  34. }
  35.  
  36. ///operatii coada
  37. int coada[1001];
  38. int st, dr;
  39.  
  40. void initCoada()
  41. {
  42. st=0;
  43. dr=-1;
  44. }
  45.  
  46. void PushCoada(int x)
  47. {
  48. //vrem sa punem elementul x in coada
  49. coada[++dr] = x;
  50. }
  51.  
  52. void PopCoada()
  53. {
  54. st++;
  55. }
  56.  
  57.  
  58.  
  59. int main()
  60. {
  61.  
  62. return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement