make2db.cpp

来自「一本全面剖析C++数据结构算法的书籍」· C++ 代码 · 共 18 行

CPP
18
字号
// test 2D array creation with exception throwing#include <iostream.h>#include "make2db.h"#include <stdlib.h> // has exit()void main(void){   int **a;   try {Make2DArray(a,2,2);}   catch (...) {       cerr << "Could not create the array" << endl;       exit(1);}   a[0][0] = 1; a[0][1] = 2; a[1][0] = 3; a[1][1] = 4;   cout << a[0][0] << ' ' << a[0][1] << endl;   cout << a[0][0] << ' ' << a[1][1] << endl;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?