1: // Filename: TXITDEMO.CPP 2: // Purpose: A test driver for the TextItems class. 4: #include <iostream> 5: using namespace std; 7: #include "TXITEMS.H" 9: int main() 10: { 11: cout << "\nThis program demonstrates use of the " 12: << "TextItems class to display \"text items\". " 13: << "\nBe sure that you know what a file of " 14: << "such items looks like, and that you have " 15: << "\nat least one available, before you attempt " 16: << "to use this program. "; 18: MyString80 fileName, title; 20: cout << "\n\nEnter full name of file containing text " 21: << "items, or end-of-file to quit program: \n"; 22: cin.getline(fileName, 82); 23: while (cin) 24: { 25: TextItems itemList(fileName); 27: cout << "Enter title of text item to display, " 28: << "or end-of-file to quit displaying items: \n"; 29: cin.getline(title, 82); 30: while (cin) 31: { 32: itemList.DisplayItem(title); 33: cout << "Enter title of text item to display, " 34: << "or end-of-file to quit displaying items: \n"; 35: cin.getline(title, 82); 36: } 38: cin.clear(); 39: cout << "Enter full name of file containing text " 40: << "items, or end-of-file to quit program: \n"; 41: cin.getline(fileName, 82); 42: cout << endl; 43: } 45: return 0; 46: }