Create a class in a h file with four float members (four elements of a 2x2 matrix). You need to implement all of the ope

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Create a class in a h file with four float members (four elements of a 2x2 matrix). You need to implement all of the ope

Post by answerhappygod »

Create a class in a h file with four float members (four
elements of a 2x2 matrix). You need to implement all of the
operators, methods and constructors in the cpp file. You will need
it to compile and produce the output: (3,14)
cpp file:
#include <iostream>
#include "Mat.h"
using namespace std;
int main(int argc, const char * argv[])
{
Mat a ( Mat::Identity );
Mat b ( 1.0f, 2.0f, 1.0f, 4.0f );
Vec v = Vec(1,2)*(((a + b) - (4*a)) + a*b);
cout << v<<endl;
return 0;
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply