text cover

Data Abstraction and Problem Solving with C++

Walls and Mirrors

by Frank M. Carrano

Addison Wesley Logo

example614.cpp

Go to the documentation of this file.
00001 
00015 #include <iostream>
00016 #include "TableB.h"
00017 
00018 using namespace std;
00019 
00020 void displayKey(TableItemType& anItem)
00021 {
00022    cout << anItem.getKey() << endl;
00023 }  // end displayKey
00024 
00025 int main()
00026 {
00027    Table   chart;
00028    KeyType keyItem;
00029 
00030    cin >> keyItem;
00031    while (!cin.eof()) // ^Z <enter> in Windows, ^D in Unix
00032    {
00033       TableItemType anItem(keyItem);
00034       try
00035       {  chart.tableInsert(anItem);
00036       }
00037       catch (TableException e)
00038       {  cout << e.what() << endl;
00039       }  // end try
00040       cin >> keyItem;
00041    }  // end while
00042 
00043 //   . . .
00044 
00045    chart.traverseTable(displayKey);  // traversal in order
00046    return 0;
00047 }  // end main

Generated on Sun Aug 27 22:04:06 2006 for AWLogo by  doxygen 1.4.6