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

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.

  • 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 dont 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.
  • image text in transcribed
Write a C++ program for finding whether the matrix is a Quattro Matrix of not. Quattre Matrix: The Matrix which the values on the corners are equal to the sum of the values around them 5 (0,0) = (0,1)+(1,0) + (1,1)|| 3122 (0.3) = (0.2) + (1.2) + (1,3) (3,0) = (2,0 + 2,1)+(3.1) 4 4 (3.3) = 2.2)+(2,3)+(3,2 . . Create a Matrix class which has a 2-darax(4x4) as a private member variable, a constructor, a destructor. Querloaded input output. addition and subtraction operators. This Matrix slass can be used for both integer and double data types. so you should use class template The constructor will gutput a message which tells a Matrix obiect has been created The destructor will output a message which tells a Matrix obiect has been destroyed User should input values for the Matrix and you should be shecking that all the values. entered by the user are between 0-25. If the value is not between 0-25 you should gutput an esser message and assign a value candomly between 0-25. The assigned random value will only be integet you don't have to deal with double candom values: The overloaded summation and subtraction operators should perform the operation by summing a subtracting the same indices from each other. Sample Summation of 2x2 Matrix (C(0,0) = A(0,0) + B(0,0)) (CC0.1) = A(0,1) + B(0,1)) C(1,0) = A(1,0) + B(1,0)) C(1.1) = A(1,1)+B The output operator should outnut the Matrix(4x4) tow by cow- You should create 2 obiects and fill them in. Then you should ask which speration to be handled. + for summation for subtraction. You should perform the entered speration and then you should stars 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 Qutryt a message. Finally, you should destroy all the abiects

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

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

More Books

Students also viewed these Databases questions

Question

Find the adjacency matrix of the graph in Fig 476.

Answered: 1 week ago