Advertisement
Huntersazzad

stack_main

Feb 29th, 2020
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. #include"stacktype.h"
  4. #include"stacktype.cpp"
  5. using namespace std;
  6.  
  7.  
  8. int main()
  9. {
  10. // int arr[5];
  11. // StackType<int> StC;
  12. // if(StC.IsEmpty()){
  13. // cout<<"stack is empty"<<endl;
  14. // }
  15. //
  16. // StC.Push(5);
  17. // StC.Push(7);
  18. // StC.Push(4);
  19. // StC.Push(2);
  20. // if(StC.IsEmpty()){
  21. // cout<<"stack is empty"<<endl;
  22. // }else cout<<"stack is not empty"<<endl;
  23. //
  24. //
  25. //if(StC.IsFull()){
  26. // cout<<"stack is full"<<endl;
  27. // }else cout<<"stack is not full"<<endl;
  28. //
  29. // for( int j=0; j<4; j++)
  30. // {
  31. // arr[j]=StC.Top();
  32. // StC.Pop();
  33. //
  34. //
  35. // }
  36. //
  37. // for( int j=3; j>=0; j--)
  38. // {
  39. // cout<<arr[j];
  40. //
  41. //
  42. //
  43. // }
  44. // cout<<endl;
  45. //for( int j=3; j>=0; j--)
  46. // {
  47. // StC.Push(arr[j]);
  48. //
  49. //
  50. //
  51. // }
  52. // StC.Push(3);
  53. // for( int j=0; j<=4; j++)
  54. // {
  55. // arr[j]=StC.Top();
  56. // StC.Pop();
  57. //
  58. //
  59. // }
  60. //
  61. // for( int j=4; j>=0; j--)
  62. // {
  63. // cout<<arr[j];
  64. //
  65. //
  66. //
  67. // }
  68. //for( int j=0; j<=4; j++)
  69. // {
  70. // StC.Push(arr[j]);
  71. //
  72. //
  73. //
  74. // }
  75. // cout<<endl;
  76. // if(StC.IsFull()){
  77. // cout<<"stack is full"<<endl;
  78. // }else cout<<"stack is not full"<<endl;
  79. // StC.Pop();
  80. // StC.Pop();
  81. // cout<<StC.Top()<<endl;
  82.  
  83. StackType<char> StC1;
  84.  
  85. int n=14;
  86. char a;
  87. freopen("in.txt","r",stdin);
  88. //cin >> n;
  89. while(n--)
  90. {
  91.  
  92. cin >> a;
  93. if(a=='(')
  94. StC1.Push(a);
  95. else if(a==')')
  96. StC1.Pop();
  97. }
  98.  
  99.  
  100.  
  101.  
  102.  
  103. // cout << StC1.IsEmpty() ;
  104.  
  105. //cout <<endl;
  106. //if(StC1.IsFull()&&StC1.IsEmpty()){
  107. // cout<<"stack is not balaced"<<endl;
  108. // }else cout<<"stack is not full"<<endl;
  109. //
  110. if(StC1.IsEmpty()){
  111. cout<<"stack is empty"<<endl;
  112. }else cout<<"stack is not empty"<<endl;
  113.  
  114. return 0;
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement