How do implement a class that displays a 2 by 2 matrix

Recommended Answers

All 2 Replies

struct matrix_2x2
{
  //interesting functions here
  double v[2][2];  
};

?

Well ifezuec, if you are wondering whats a struct...its just like a class with everything (data members as well as member functions) public by default.
If you wanted strictly a class you can simply replace the "struct" with "class" but in that case your 2d matrix will no longer be public by default.

Hope it helps.


P.S: Daniweb has a policy that we shouldn't be giving out codes till you show some good efforts. The hint by Aranarth is, I think, enough for you to start.
Good luck...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.