#include #include #include //for class stack #include //for class string using namespace std; int main() { stack s; //The fill name of this data type is std::stack s.push(10); s.push(20); s.push(30); cout << s.top() << "\n"; //Output the most recently pushed it. s.pop(); //Remove the most recently pushed item. cout << s.top() << "\n"; s.pop(); cout << s.top() << "\n"; s.pop(); struct person { string firstname; string lastname; }; person a[] { {"George", "Washington"}, {"John", "Adams"}, {"Thomas", "Jefferson"} }; const size_t n {size(a)}; //the number of elements in the array stack t; for (int i {0}; i < n; ++i) { t.push(a[i]); } for (int i {0}; i < n; ++i) { person p {t.top()}; t.pop(); cout << p.firstname << " " << p.lastname << "\n"; } return EXIT_SUCCESS; }