// Project PersonStack, File main1.cpp // Create and use a templated stack class. #include #include #include #include "..\\person.h" #include "stack.cpp" using namespace std; int main() { // Declare Person variable for input. Person p; // Declare a Person stack of size 50. Stack s(50); // 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.is_empty()) { cout << s.peek().get_name() << endl; s.pop(); } return EXIT_SUCCESS; }