// File: tdtest3b.cpp // // This file checks that version 3 of // the TwoDimArray class works. // // The [][] operator should do range checking. // #include #include "twodim3.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 + '0' ; } } 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 + 0.33 ; } } cout << "\n\nMod " << N << " Multiplication Table:\n\n" ; B.Print() ; // cout << "Kaboom!\n\n" ; // B[1][17] = 91 ; }