Advertisement
Guest User

blabla

a guest
Feb 9th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <stack>
  2. #include <string>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6. stack <string> S;
  7.  
  8. void makni_bombe(stack *S) {
  9.     stack <string> A;
  10.     while (!S.empty()) {
  11.         if (S.top == '*') S.pop;
  12.         else {
  13.             A.push(S.top);
  14.             S.pop;
  15.         };
  16.     };
  17.     S.swap(A);
  18. }
  19.  
  20. int main() {
  21.     S.push("a");
  22.     S.push("*");
  23.     S.push("b");
  24.     S.push("*");
  25.     S.push("c");
  26.     S.push("d");
  27.  
  28.     cout << "Ima " << S.size() << " clanova u nizu" << endl; /*br clanova steka*/
  29.     cout << " " << endl;
  30.     cout << "vrh je " << S.top() << endl;
  31.     makni_bombe(S);
  32.         cout << "Ima " << S.size() << " clanova u nizu" << endl; /*br clanova steka*/
  33.     cout << " " << endl;
  34.     cout << "vrh je " << S.top() << endl;
  35.     system("pause");
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement