// File: p3main2.cpp // // Tests ZoomTable functionality. // #include #include "ZoomTable.h" using namespace std ; ZoomTable ZTfunc(ZoomTable H) { ZoomTable A ; cout << "\n\nInside function ZTfunc(), H = \n" ; H.dump() ; cout << "\n" ; A = H ; A.insert(2,0,1000) ; A.insert(2,1,1001) ; A.insert(2,2,1002) ; A.insert(2,3,1003) ; A.insert(2,4,1004) ; A.insert(2,5,1005) ; cout << "\n\nEnd of function ZTfunc(), A = \n" ; A.dump() ; cout << "\n" ; cout << "\n\nEnd of function ZTfunc(), H = \n" ; H.dump() ; cout << "\n" ; return A ; } int main() { ZoomTable Z(5,7) ; Node *ptr ; cout << "Z has " << Z.rows() << " rows and " << Z.cols() << " columns.\n\n" ; // After these insertions and deletions, the ZoomTable // should look like the diagram in the project description. Z.insert(0,5,41) ; Z.insert(0,6,42) ; Z.insert(0,4,43) ; Z.insert(0,0,44) ; Z.remove(0,5) ; Z.insert(1,3,45) ; Z.insert(1,4,46) ; Z.insert(4,6,47) ; Z.insert(2,1,48) ; Z.insert(2,4,49) ; Z.insert(3,5,27) ; Z.insert(2,5,50) ; Z.insert(3,0,51) ; Z.insert(4,0,52) ; Z.insert(3,3,17) ; Z.insert(1,6,54) ; Z.insert(4,4,37) ; Z.insert(3,3,56) ; ptr = Z.find(2,4) ; Z.remove(ptr) ; ptr = Z.find(3,5) ; ptr->set(49) ; Z.insert(4,4,55) ; cout << "\nIn main(), Original ZoomTable Z:\n" ; Z.dump() ; ZoomTable V = ZTfunc(Z) ; cout << "\nIn main(), number Check:\n" ; ptr = Z.FirstInCol(5) ; cout << ptr->get() << " == 50?\n" ; cout << Z.at(4,6) << " == 47?\n" ; cout << Z.at(3,3) << " == 56?\n" ; cout << Z.at(4,4) << " == 55?\n" ; cout << "\n" ; cout << "\n\nIn main(), ZoomTable V:\n" ; V.dump() ; cout << "\n\nIn main(), ZoomTable Z:\n" ; Z.dump() ; }