1 #include <iostream> 2 using namespace std; 3 4 int main(){ 5 int row,column,k=0; 6 cin >> row >> column; 7 8 int **p = new int* [row]; 9 for(int i = 0; i < row; i++) 10 p[i] = new int[column]; 11 12 for(int i = 0; i < row; i++) 13 for(int j = 0; j < column; j++) 14 p[i][j] = ++k; 15 16 for(int i = 0; i < row; i++){ 17 for(int j = 0; j < column; j++) 18 cout << p[i][j] << " "; 19 cout << endl; 20 } 21 22 for(int i = 0; i < row; i++) 23 delete []p[i]; 24 p = NULL; 25 return 0; 26 }