![]() |
|
#1
|
||||
|
||||
polynomial programI have to make a polynomial program that can add, subtract and multiply.
I'm asked to make the following functions: add An arithmatic addition operation that adds one instance of Polynomial to another. subtract An arithmatic subtraction operation that subtracts one instance of Polynomial by another. multiply An arithmatic multiplication operation that multiplies one instance of Polynomial by another. multiply An arithmatic multiplication operation that multiplies an instance of Polynomial by an integer. raiseDegree An arithmatic multiplication operation that multiplies an instance of Polynomial by a polynomial of the form xk for some non-negative integer k. The thing I am having trouble with is this next part: The add, subtract, raiseDegree and the two multiply operations should be implemented as void member functions that mutate the contents of the target Polynomial instance. I have a Polynomial class and the above functions are member functions of this Polynomial. A polynomial instance is basically composed of an array with the index representing the power of x. I'm just confused on what it is telling me to do. I would rather just have the functions return an instance of a polynomial but it's not what it's asking me to do. It doesn't seem effective to pass 3 instances of the Polynomial class (first 2 being the two instances being added together and the 3rd which will end up being the sum of the two instances). I am quite sure this isn't what is expected...anyone have any suggestions? I am writing in c++ by the way. ** maybe i am to pass just one of the instances of polynomial to be added, and another to store the sum Therefore my function would look like this: CPP / C++ / C Code:
and then use it like this: CPP / C++ / C Code:
that's my best guess...but i'd rather get a lil more direction/confirmation. |
Recent GIDBlog
Toyota - 2008 August Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Is my program coded well? | dave88 | C Programming Language | 6 | 14-Oct-2005 09:18 |
| Type casts ? | kai85 | C++ Forum | 12 | 23-Jun-2005 12:04 |
| [TUTORIAL] Calling an external program in C (Linux) | dsmith | C Programming Language | 4 | 22-Apr-2005 13:30 |
| fltk-2.0 cvs | Plumb | FLTK Forum | 20 | 13-Nov-2004 07:10 |
| Need help with a C program (Long) | McFury | C Programming Language | 3 | 29-Apr-2004 20:06 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The