Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stack>
- #include <string>
- #include <iostream>
- using namespace std;
- stack <string> S;
- void makni_bombe(stack *S) {
- stack <string> A;
- while (!S.empty()) {
- if (S.top == '*') S.pop;
- else {
- A.push(S.top);
- S.pop;
- };
- };
- S.swap(A);
- }
- int main() {
- S.push("a");
- S.push("*");
- S.push("b");
- S.push("*");
- S.push("c");
- S.push("d");
- cout << "Ima " << S.size() << " clanova u nizu" << endl; /*br clanova steka*/
- cout << " " << endl;
- cout << "vrh je " << S.top() << endl;
- makni_bombe(S);
- cout << "Ima " << S.size() << " clanova u nizu" << endl; /*br clanova steka*/
- cout << " " << endl;
- cout << "vrh je " << S.top() << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement