Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program for finding whether the matrix is a Quattro Matrix or not. Quattro Matrix: The Matrix which the values on the corners

image text in transcribed

Write a C++ program for finding whether the matrix is a Quattro Matrix or not. Quattro Matrix: The Matrix which the values on the corners are equal to the sum of the values around them. 53122 (0,0) = 0,1)+(1,0) + (1,1) (0.3) = 0.2) + (1.2) + (1,3) 0 2 14 (3.0) =(2,0) +(2,1)+(3.1) 4 4 (3.3) = 2.2)+(2,3)+(3.2 146 9 Create a Matrix class which has a 2-d array(4x4) as a private member variable, a constructor a destructor, overloaded input, output, addition and subtraction operators. This Matrix class can be used for both integer and double data types, so you should use class template The constructor will output a message which tells a Matrix object has been created. The destructor will output a message which tells a Matrix object has been destroyed. User should input values for the Matrix and you should be checking that all the values entered by the user are between 0-25. If the value is not between 0-25 you should output an error message and assign a value randomly between 0-25. The assigned random value will only be integer you don't have to deal with double random values. The overloaded summation and subtraction operators should perform the operation by summing or subtracting the same indices from each other. Sample Summation of 2x2 Matrix (C(0,0) = A(0,0) + B(0,0)) (C(0.1) = A(0,1)+ B(0,1)) (C(1,0) = A(1,0) +B(1,0)) (C(1,1) = A(1,1) + B(1,1)) The output operator should output the Matrix(4x4) row by row- You should create 2 objects and fill them in. Then you should ask which operation to be handled. '+' for summation -- for subtraction. You should perform the entered operation and then you should store the result in another object. You should output the resultant Matrix. Finally, you should check whether it is a Quattro Matrix or not. If it is a Quattro Matrix then you should output a message. Finally you should destroy all the objects

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

2nd Edition

0471180742, 978-0471180746

More Books

Students also viewed these Databases questions