/* * File: listtest.cpp * Author: Robert I. Pitts * Last Modified: Fall 2000 * Topic: Templates * ----------------------------------------------------- * * OVERVIEW: * ========= * This program tests a listed list of integers. * */ #include #include "list.h" using namespace::std; int main() { // Create an integer list. List list; // Add some values to it. while (true) { cout << "Enter an item for the list (0 to end): "; int item; cin >> item; if (item == 0) break; list.insertAtBeginning(item); } // Remove and print out each value. cout << "\nThe items added were:" << endl; while (!list.isempty()) { int item = list.removeFromEnd(); cout << item << endl; } }