Question: C++ Matrix and Fibonacci Sequence Program I am having difficulties figuring out how to code this project in C++. If someone can help me or

C++ Matrix and Fibonacci Sequence Program

I am having difficulties figuring out how to code this project in C++. If someone can help me or explain to me with alittle more detail on what I have to do it would be greatly appreciated. The base code is below

#include

using namespace std;

class Mat22

{

//the class for 2 by 2 matrices

public:

Mat22(); // default constructor

Mat22(int a,int b, int c, int d); // set the matrix as the input

Mat22(const Mat22 &b); // copy constructor

void operator=(const Mat22 &b); // assignment operator

Mat22 operator+(const Mat22 &b);// add two matrices

Mat22 operator-(const Mat22 &b);// similar as above

Mat22 operator*(const Mat22 &b);// matrix multiplication

Mat22 fastexp(int n);// compute matrix to the power of n

void display(ostream &out);// print the matrix, whatever way you like as long as it makes sense

private:

int a,b,c,d;// store matrix [a,b]

// [c,d]

};

//implement operator> so that the following operations are possible

// cout > a

// make sure they can be chained

int FastFib(int n);

int main()

{

return 0;

}

C++ Matrix and Fibonacci Sequence Program I am having difficulties figuring out

In this assignment, you are given the cpp file HW2.cpp, which contains a prototype of the clas:s Mat22. Basically, the class is a structure for 2 by 2 matrices - the integers a,b,c, and d represent the . The class should support several matrix operations, such as addition, multiplica- tion, and fast exponentiation. The class will be used to implement the fast method that computes Fibonacci sequence as we discuss in the class. We specify the details in the following tasks. You al matrix must submit only a single cpp file. Task 1: Implement the constructors and the assignment operator. The specification is clear as described in the comments. Task 2: Implement the operator overloading for the arithmetic operations +, -,*. Your code should implement the functionalities as below: a2 b2 d2 d1 d1 The operation for subtraction is similar to the addition. Task 3: Implement the display function (that prints the matrix). Then implement operator overloading for >> and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!