Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main() {
- std::vector<int> a;
- std::vector<int> b;
- /*
- - switch X, X = {1,2}
- - add Y
- - show
- - pop
- */
- std::string s;
- vector<int>* current = &a;
- while (std::cin >> s) {
- if (s == "switch") {
- int num;
- std::cin >> num;
- if (num == 1) {
- current = &a;
- } else {
- current = &b;
- }
- } else if (s == "add") {
- int y;
- std::cin >> y;
- current->push_back(y);
- } else if (s == "show") {
- for (auto elem : *current) {
- std::cout << elem << " ";
- } else {
- current->pop_back(); // ั ะฐะนะฟ.
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement