![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
Write a program which overloads a binary Minus (-) operatorWrite a program which overloads a binary Minus (-) operator,
The program will contain a class Matrix, This class will contain a private data member Array[][] which store int values. The class will further contain a Default constructor, get() function which takes values for array from the user and also contain a Display function witch display the array on the screen, In main function create three objects Mat1, Mat2, Mat3 of this class, first call get() and Display() functions with Mat1 and Mat2 objects then implement the statement Mat3 = Mat1 - Mat2; and call Display() function with Mat3. Note: The matrix should be 2x2. Please help me to correct following code: Code:
Last edited by LuciWiz : 23-Jun-2007 at 14:25.
Reason: Added [code] tags
|
|||
|
#2
|
|||
|
|||
Re: Write a program which overloads a binary Minus (-) operatorIs this really C++ code?
|
|
#3
|
|||
|
|||
Re: Write a program which overloads a binary Minus (-) operatorQuote:
|
|
#4
|
|||
|
|||
Re: Write a program which overloads a binary Minus (-) operatorQuote:
There is not a single line of anything in your post that is correct. (Well, #include<iostream.h> is not technically incorrect, but the use of <iostream.h> is not recommended.) Nothing else is valid; not even close. Period. The way it works is: you seriously try to make something that satisfies the assignment. If you have problems, then show us what you seriously tried and ask specific questions. Start at the beginning: 1. Make a Matrix class according to your assignment. 2. Write a program with a main() function that creates object of your class and test the display function. (You will have to have some way of getting things into your matrix. Maybe a constructor that takes arrays or vectors of ints. Whatever.) Then, after you can create and display objects of the class: 3. Look at examples of overloaded operators. Look in your book. Look in class notes. Look for examples on the web. Look somewhere. You can't just make up your own rules for creating something and call it C++. (Well, you can, but I'm guessing it won't work the way that you wish it would.) If you have problems anywhere along the way, then show us what code you actually compiled (or tried to compile). If there were any messages that you don't understand, then post the messages also. Regards, Dave |
Recent GIDBlog
Running Linux Programs at Boot Time by gidnetwork
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Airport Log program using 3D linked List : problem reading from file | batrsau | C Programming Language | 11 | 29-Feb-2008 07:44 |
| BOOKEEPING program, HELP!! | yabud | C Programming Language | 10 | 17-Nov-2006 03:48 |
| Need help writing a program that reads from a file and converts it to binary. | edd_y_123 | C Programming Language | 3 | 18-Dec-2005 10:21 |
| C++ PhoneBook | marita | C++ Forum | 46 | 12-Jun-2005 12:10 |
| Anyone can write a program code for this??? | chriskan76 | C Programming Language | 1 | 19-Oct-2004 20:25 |
Network Sites: GIDNetwork · GIDApp · GIDSearch · Learning Journal by J de Silva, The