Datová struktura “stack”

{“https:\/\/www.jdoodle.com\/a\/czj?format=text”:”#include <iostream>\n#include <stack>\nusing namespace std;\n\nint main() {\n stack<int> st;\n st.push(1);\n st.push(3);\n st.push(4);\n \n cout << st.size() << endl;\n}”,”https:\/\/www.jdoodle.com\/a\/czn?format=text”:”#include <iostream>\n#include <stack>\nusing namespace std;\n\nint main() {\n stack<int> st;\n st.push(1);\n st.push(2);\n st.push(3);\n \n while(! st.empty()) {\n cout << st.top() << ";";\n st.pop();\n }\n}”,”https:\/\/www.jdoodle.com\/a\/czf?format=text”:”#include <iostream>\n#include <stack>\nusing namespace std;\n\nstruct Employee {\n string name;\n int wage;\n \n Employee(string n, int w): name(n), wage(w) {}\n};\n\nostream& operator<<(ostream& os, const Employee& e) {\n os << "Jmeno: " << e.name << ", plat: " << e.wage << endl;\n return os;\n}\n\nint main() {\n stack<Employee> st;\n st.emplace("Ale\u0161", 20000);\n st.emplace("Monika", 30000);\n st.emplace("Jaroslav", 15000);\n \n while(! st.empty()) {\n cout << st.top();\n st.pop();\n }\n return 0;\n}”}


Datová struktura “stack”
Ohodnoťte tento článek