R E F L E X E S
Mind@Work
Isc object passing 2024
1.A class matrix contains a @d integer array of order[m * n]. The maximum
value possible for both m and n is 10. Design a class matrix to find the
product of the two matrices. The details of the members of the class are
given below:
Class name : matrix
Data members:
atm[][] : to store the matrix
m, n : integer to store the number of rows and columns
Member functions:
Matrix(…..) : initialize m, n and to allocate memory to member array
void fnGet() : to fill the member array
void fnDisplay() : to show the member matrix
Matrix fnMultiply(Matrix A) : multiply the current object from the matrix of
parameterized object and return the resulting object.
Specify the class Matrix, Define main(), giving the details of the above
member data and methods only.
2.A class Shuffle contains a 2D array of order (m*n) where the
maximum values of both m and n is 5. Design the class to shuffle the
matrix (the first row becomes the last, the second row becomes the
first and so on.)
Class name :Shuffle
Data members
mat[][], m,n;
Member functions:
Shuffle(int mm, int nn) : constructor to initialize the data members
m=mm and n=nn
void input() : enters the elements of the array
void cyclic(Shuffle P) : enables the matrix of the object(P) to shift
each row upwards in a cyclic manner and store the resultant matrix in
the current object.
void display() : display the matrix elements.
Define the main() to create an object and call the methods accordingly
to enable the task of shifting the array elements.
3.A class Whilly contains a 2D array of order [m * n]. Perform a right
circular shift and a left circular shift on alternate rows of the array.
For example: Input m=5, n=4
The matrix is:
20 2 24 25
48 18 13 47
43 18 30 32
22 45 30 38
48 12 18 37
©REFLEXES CLOUD COMPUTING AND APPLICATION DEVELOPMENT:
Email:
[email protected] Gagnanchal Market:37drabanidutta road
Output:
Right circular shift and left circular shift on alternate rows of the
matrix:
The matrix is:
25 20 2 24
18 13 47 48
32 43 18 30
45 30 38 22
37 48 12 18
Class name :Whilly
Data member:
whilly[][] : to store the amtrix
int m, n : integer to store the number of rows and columns
Member functions:
Whillyl(……) : initialize m, n and to allocate memory to member
array
void fnGet() : to fill the member array
void fnDisplay() : to show the member matrix
Whilly fnChangeMat() : modify the current matrix as per the given criteria
and returns it.Specify the class Whirl, and define main() , giving the details of
the above member data and methods.