
/*----------------------------------------------------------------------*/
/*                      DynamicArray2.cpp                               */
/* Authored By : H.P.Kasmaei                                            */
/* Last Update : September 14, 2007                                     */
/* http://www.hpkclasses.ir/courses/datastructure/DynamicArray2.cpp      */
/*----------------------------------------------------------------------*/

#include <iostream.h>

void main()
{
   int i,j,
       row, col,                   //keep array size
       **num;                      //pointer to array

   cout<<"\ninput number of row:";
   cin>>row;                       //get array row
   cout<<"\ninput number of column:";
   cin>>col;                       //get array column

   num = new int *[row];           //allocate memory to a row of array


   for (i=0; i<row; i++){
      num[i] = new int(col);       //allocate memory to columns of a row
      for (j=0; j<col; j++)
	cin>>num[i][j];            //get array elements
      }

   for (i=0; i<row; i++)           //show array elements
      for (j=0; j<col; j++)
      cout<<num[i][j]<<endl;

}

