Numeric Array - Fill Prime numbers in 2D Array (2010SP)

Design a class Prime to fill an array of order [m x n ] where the maximum value of both m and n is 20, with the first [m x n ] prime numbers Row wise . The details of the members of the class are given below:

Class name                       :     Prime

Data members / instance variables :

           arr[ ][ ]                      :     Two dimensional integer array.

           r                                  :      integer to store the number of rows.

           c                                  :      integer to store the number of columns.

Member functions :

           Prime( )                       :       to accept the size of the array.

           int  isprime ( int p )    :      return 1 if number is prim and 0 if not prime.

           void fill ( )                    :      to fill the elements of the array with the

                                                        first (m x n ) prime numbers.

           void display ( )            :      displays the array the array in a matrix form.

 

Specify  the  class Prime  giving  details  of  the  constructor  and  member  functions     int  isprime (int),  void fill( ) and void display( ) with  main( ) function to create an object and call the function accordingly.