// File: tdtest2.cpp // // This file checks that // the TwoDimArray class works. // // The [][] operator should do range checking. // #include #include "twodim2.h" using namespace std ; int main() { unsigned int N = 7 ; TwoDimArray A(N,N) ; // Initialize A with mod 7 times table for (unsigned int i = 0 ; i < N ; i++) { for (unsigned int j = 0 ; j < N ; j++) { A.at(i,j) = (i*j) % N ; } } cout << "\n\nMod " << N << " Multiplication Table:\n\n" ; A.Print() ; N = 9 ; TwoDimArray B(N,N) ; // Initialize B with mod 9 times table for (unsigned int i = 0 ; i < N ; i++) { for (unsigned int j = 0 ; j < N ; j++) { B[i][j] = (i*j) % N ; } } cout << "\n\nMod " << N << " Multiplication Table:\n\n" ; B.Print() ; cout << "Kaboom!\n\n" ; B[1][17] = 91 ; }