// Project PersonStack, File main2.cpp // Use the STL stack datatype #include #include #include #include #include "..\\person.h" using namespace std; int main() { // Declare Person variable for input. Person p; // Declare an STL stack datatype. stack s; // Declare and open input file. ifstream fin("c:\\Persons.txt"); // Push all person objects onto the stack. while (fin >> p) s.push(p); // Print names in reverse order. while(!s.empty()) { cout << s.top().get_name() << endl; s.pop(); } return EXIT_SUCCESS; }