473,385 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

On right track?

a. Create a class named Matrix2x2 having four floating point data members named n1, n2, n3, n4. The class's default constructor should provide data members with default values of 1 if no explicit user initialization is provided. Additionally, provide member functions for displaying an object's data values and for calculating the determinant (see below). Also provide the class with an overloaded operator function that is capa¬ble of multiplying two Matrix2x2 objects according to the following procedure:
example of Matrix2x2 : | n1 n2 |
| n3 n4 |

multiplication:
|n1 n2| |N1 N2| |n1N1 + n2N3 n1N2 + n2N4|
|n3 n4| x |N3 N4| = |n3N2 + n4N4 n3N2 + n4N4|

determinant of |n1 n2| = n1n4 – n3n2
|n3 n4|
b. Include the class in a working C++ program that tests each of the class's member functions.
Expand|Select|Wrap|Line Numbers
  1. #include <iostream.h>
  2. #include <stdlib.h>
  3. #include <conio.h>
  4.  
  5.  
  6. class Matrix2x2
  7. {
  8. private:
  9. float n1;
  10. float n2;
  11. float n3;
  12. float n4;
  13.  
  14. public:
  15. Matrix2x2(int = 1. int = 1, int = 1, int =1);
  16. void calcDet();
  17. Matrix2x2 operator*();
  18.  
  19. };
  20.  
  21. Matrix2x2::Matrix2x2(int nOne, int nTwo, int nThree, int nFour)
  22. {
  23.  n1 = nOne;
  24.  n2 = nTwo;
  25.  n3 = nThree;
  26.  n4 = nFour;
  27. }
  28.  
  29. void Matrix2x2::calcDet()
  30. {
  31.  
  32.  
  33.  
  34. }
  35.  
  36. Matrix2x2 Matrix2x2::operator*()
  37. {
  38.  
  39.  
  40. }
Oct 13 '05 #1
0 1163

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sandman | last post by:
Just looking for suggestion on how to do this in my Web application. The goal is to keep track of what a user has and hasn't read and present him or her with new material I am currently doing...
14
by: Mark | last post by:
Yes, my family business wants to create an accounting database to keep track of invoices, production, inventory, man hours, etc.... There will be two kinds of users to access the database, on two...
0
by: uncle jenny | last post by:
something right out of a box +++ eminem 'lose yourself' +++ "thanks paulie" yur welcome
1
by: shank | last post by:
Imagine a CD of say 20 songs Each song is a table row I need a way for the user to change the way the songs are listed by allowing them to change the track numbers. What is the smartest...
1
by: EnjoyNews | last post by:
I have some tables that is connected in a table like this: TracklistID CDid SongID it could look like this 1 1 1
3
by: johnny | last post by:
hi all! I am starting to study the best way to track site visitors. Logfiles stats which come with every web hosting, have little metrics to be analyzed and also problems with cached pages which...
2
by: sara | last post by:
I have been working this idea for a little over a week now and am not convinced I have a good solution. I have a little system that tracks Purchase Orders (POKey autonum, PONum are both ont...
7
by: David | last post by:
i think i just realized i'm an idiot. again. (not syntactically correct code... just pieces to illustrate) class StateObject { members like socket, receiveBuffer, receiveBufferSize,...
5
by: Timeri | last post by:
This is a bit confusing until you actually see what I'm talking about but the main content of my page is not growing with the right column. I want the main content (left/larger column) to take into...
0
by: ateale | last post by:
Hi guys! I am having a bit of difficulty trying to get to a 'timecode' track in a QuickTime file using the QTKit framework in Mac OSX 10.5 I am using XCode 3. I have a QTMovie object (set as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.