pop_test.cpp 582 B

123456789101112131415161718192021222324252627282930313233
  1. #include "simple/file.hpp"
  2. #include "simple/file/string_stack.h"
  3. #include <string>
  4. #include <iostream>
  5. using namespace std;
  6. using namespace simple;
  7. using file::string_stack::pop;
  8. using file::string_stack::push;
  9. int main()
  10. {
  11. string one, two;
  12. string command;
  13. while(cin >> one)
  14. {
  15. cout << one << "\n\n";
  16. while(cin >> command)
  17. {
  18. if("pop" == command)
  19. push( two, pop(one) );
  20. else if("push" == command)
  21. push( one, pop(two) );
  22. cout << "one: " << one << '\n';
  23. cout << "two: " << two << "\n\n";
  24. }
  25. two.clear();
  26. cin.ignore();
  27. cin.clear();
  28. }
  29. return 0;
  30. }