Make your own free website on Tripod.com


Home Work quesions - 2 dimensional arrays (matrix)
 

1. Write a function that will let you enter numbers into a 2 dimensional array.

void enter(int [][]  ma)

 

2 Write a function that will print out a matrix in table form.

   void print(int [][] m)

 

3. Write a function that will give you the sum of the numbers in a matrix.

  int sum(int [][] m )

 

4. Write a function that will give you the sum of the numbers in a row in a matrix.

  int rowsum(int [][], int row);

 

5. Write a function that will return the smallest number in a matrix.

  int smallest(int [][] m)

 

6. Write a function that will print out the numbers in the diagonal in a square matrix.

   int diagsum(int [][] m)

 

7. Write a function that will fill a matrix with random numbers.

  void fill(int [][] m)

 

8. Write a function that will print out numbers in a particular column.

  void printcolumn(int [][] m,int col)

 

9. Write a function that will switch every other row in a matrix.

 void switch(int [][] m)

 

10. Write a function that will return the sum of the numbers in the top half of a matrix.

  int getsum(int [][] m)

 

11. Write a function the will return the average of the numbers in a matrix.

 double avg(int [][]> m)

 
12. Write a function that will print out all the odd numbers in the matrix that have all numbers 
or borders all around it. (east, north, south, east)

 void printodd(int [][] m)

 

13. Write a function that will return the row that has the largest sum

   int row(int [][] m)

 

14.Write a function that will return the sum of the numbers in the outside of the matrix.

  int bordersum(int [][] m)

 

15. Write a function that will return true if a row is in ascending order.

    bool rowinorder(int [][] m, int row)

 

16. Write a function that will return true if matrix is in order. You may call function written above. 
In addition in order for matrix to be in order each element the last column of a row must be smaller 
than first element in next row.

  bool matrixinorder(int [][] m)

 

17. Write a function that will return true if there are no zeroes in a matrix.

   bool nozeroes(int [][] m)

 

18. Write a function that will return sum of matrix. You must call function written in number 4.

   int matrixsum(int [][] m)

 

19. Write a function that will flip a matrix so that you get the mirror image of it.

  void flip(int [][] m)