阅读下列说明和C++程序,将应填入(n)处的字句写在对应栏内。【程序1说明】 程序1中定义了数组的类模
阅读下列说明和C++程序,将应填入(n)处的字句写在对应栏内。【程序1说明】程序1中定义了数组的类模板,该模板使得对于任意类型的二维数组,可以在访问数组元素的同时,对行下标和列下标进行越界判断,并给出相应的提示信息(C++语言本身不提供对下标越界的判断)。【程序1】include < iostream. h >template < class T > class Array2D;template < class T > class Array2DBody {friend (1);T * tempBody;int iRows, iColumns, iCurrentRow;Array2DBody(int Rows,int Cols) {tempBody =(2);iRows = Rows;iColumns = Cols;iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
【程序1说明】程序1中定义了数组的类模板,该模板使得对于任意类型的二维数组,可以在访问数组元素的同时,对行下标和列下标进行越界判断,并给出相应的提示信息(C++语言本身不提供对下标越界的判断)。【程序1】include < iostream. h >template < class T > class Array2D;template < class T > class Array2DBody {friend (1);T * tempBody;int iRows, iColumns, iCurrentRow;Array2DBody(int Rows,int Cols) {tempBody =(2);iRows = Rows;iColumns = Cols;iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
程序1中定义了数组的类模板,该模板使得对于任意类型的二维数组,可以在访问数组元素的同时,对行下标和列下标进行越界判断,并给出相应的提示信息(C++语言本身不提供对下标越界的判断)。【程序1】include < iostream. h >template < class T > class Array2D;template < class T > class Array2DBody {friend (1);T * tempBody;int iRows, iColumns, iCurrentRow;Array2DBody(int Rows,int Cols) {tempBody =(2);iRows = Rows;iColumns = Cols;iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
【程序1】include < iostream. h >template < class T > class Array2D;template < class T > class Array2DBody {friend (1);T * tempBody;int iRows, iColumns, iCurrentRow;Array2DBody(int Rows,int Cols) {tempBody =(2);iRows = Rows;iColumns = Cols;iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
include < iostream. h >template < class T > class Array2D;template < class T > class Array2DBody {friend (1);T * tempBody;int iRows, iColumns, iCurrentRow;Array2DBody(int Rows,int Cols) {tempBody =(2);iRows = Rows;iColumns = Cols;iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
template < class T > class Array2D;template < class T > class Array2DBody {friend (1);T * tempBody;int iRows, iColumns, iCurrentRow;Array2DBody(int Rows,int Cols) {tempBody =(2);iRows = Rows;iColumns = Cols;iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
template < class T > class Array2DBody {friend (1);T * tempBody;int iRows, iColumns, iCurrentRow;Array2DBody(int Rows,int Cols) {tempBody =(2);iRows = Rows;iColumns = Cols;iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
friend (1);T * tempBody;int iRows, iColumns, iCurrentRow;Array2DBody(int Rows,int Cols) {tempBody =(2);iRows = Rows;iColumns = Cols;iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
T * tempBody;int iRows, iColumns, iCurrentRow;Array2DBody(int Rows,int Cols) {tempBody =(2);iRows = Rows;iColumns = Cols;iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
int iRows, iColumns, iCurrentRow;Array2DBody(int Rows,int Cols) {tempBody =(2);iRows = Rows;iColumns = Cols;iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
Array2DBody(int Rows,int Cols) {tempBody =(2);iRows = Rows;iColumns = Cols;iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
tempBody =(2);iRows = Rows;iColumns = Cols;iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
iRows = Rows;iColumns = Cols;iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
iColumns = Cols;iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
iCurrentRow = -1;}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
}public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
public:T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
T& operator[ ] (int j){bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
bool row_ error, column_ error;row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
row_ error = column_ error = false;try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
try {if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
if (iCurrentRow < 0||iCurrentRow > = iRows)row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
row_ error = true;if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
if(j < 0||j > = iColumns)column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
column_error = true;if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
if(row_error = = true [ [ column_ error = = true)(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
(3);}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
}catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
catch(char) {if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
if (row_error = = true)cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
cerr < < "行下标越界"[" < < iCurrentRow < < "]";if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
if(colmnn_error = = true)cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
cerr< <"列下标越界[" < <j< <"]";cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
cout < < "\n";}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
}return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
return tempBody[ iCurrentRow * iColumns + j ];}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
}~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
~ Array2 DBody () { delete [ ] tempBody; } }; template < class T > class Array2D {Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
Array2DBody < T > tBody;public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
public:Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
Array2DBody < T > & operalor[ ] (int i) {tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
tBody, iCurreutRow = i;(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
(4);Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
Array2D(int Rows,int Cols): (5) {} };void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
void main(){Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
{Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
Array2D <int> al (10,20 );Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
Array2D <double> a2(3,5);int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
int bl;double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
double b2;b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
b1=a1[-5][10];//有越界提示:行下标越界[-5]b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
b1=a1[10][15];//有越界提示:行下标越界[10]b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
b1=a1[1][4];//没有越界提示b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
b2=a2[2][6];//有越界提示:列下标越界[6]b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
b2=a2[10][20];//有越界提示:行下标越界[10]列下标越界[20]b2=a2[1][4];//没有越界提示}
b2=a2[1][4];//没有越界提示}
}
点击查看答案