assign5/mat.cpp
// assert r,c is in matrix
assert r,c is in matrix
assert r c is in matrix
void Matrix::assertIndexOK(int r, int c, std::string msg) const
{
    if (r<0 || r>=maxr || c<0 || c>=maxc) {
        if (name.length()==0) {
            printf("ERROR(%s): index out of bounds: asking for (%d, %d) but size is %d X %d\n",
                   msg.c_str(), r, c, maxr, maxc);
        }
        else {
            printf("ERROR(%s): index out of bounds: asking for (%d, %d) but size of matrix \"%s\" is %d X %d\n",
                   msg.c_str(), r, c, name.c_str(), maxr, maxc);
        }
        exit(1);
    }
}
void Matrix :: assertIndexOK ( int r , int c , std :: string msg ) const { if ( r < 0 || r >= maxr || c < 0 || c >= maxc ) { if ( name . length ( ) == 0 ) { printf ( " \n " , msg . c_str ( ) , r , c , maxr , maxc ) ; } else { printf ( " \" \" \n " , msg . c_str ( ) , r , c , name . c_str ( ) , maxr , maxc ) ; } exit ( 1 ) ; } }
assert r,c is in matrix
assert r c is in matrix