![]() |
|
#1
|
|||
|
|||
polynomial class can't return a full dynamic arrayI'm trying to create a polynomial class that represent the polynomial.
When i overload the + operator and try to return a WHOLE polynomial, it doesn't work. It only returns the first term. I tried everything to try to fix it but i dont know what to do. could someone please help me. if i can figure out how to overload just one of the operator i should be able to do the rest of them myself. I need the function to return the whole class not just the first object in the class this is the header file CPP / C++ / C Code:
this is the implementation file CPP / C++ / C Code:
this is the program that uses the class CPP / C++ / C Code:
this is what i get when i run the program csci>use-polynomial 3.5 5 2.4 9 1.3 0 1.3 0 0 1 0 2 0 3 0 4 3.5 5 0 6 0 7 0 8 2.4 9 1.3 0 0 1 0 2 0 3 0 4 3.5 5 0 6 0 7 0 8 2.4 9 2.6 0 1.6976e-314 0 9 i will appreciate any kind of help... |
|
#2
|
||||
|
||||
Re: polynomial class can't return a full dynamic arrayTry printing out debugging messages, like "cout << p3.degree_poly();" immediately before and after the math operations. This can help you pinpoint where the problem is. Also, since you have a copy constructor, you could try using it in the + operator overload. Maybe "polynomial p2 = polynomial(this)" ("polynomial(&this)"? not sure...), then perform the addition to it. I'm not sure how much of a difference this would make, but it never hurts to try.
Gamer_2k4 |
|
#3
|
|||
|
|||
Re: polynomial class can't return a full dynamic arrayi have tried what you told me to do. i did get it to somewhat work. but i didn't have much luck. i did find where the error was so, i decide to change that and then something else went wrong. If i ever did manage to get the thing to work it never return the FULL dynamic array so i really don't know what to do.
|
Recent GIDBlog
Developing GUIs with wxPython (Part 4) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| need help with a console menu system | BullBuchanan | C++ Forum | 6 | 20-Aug-2006 14:46 |
| determinant algorithms | Blake | C++ Forum | 11 | 13-Mar-2006 18:36 |
| Problem with one variable | bretter | C++ Forum | 1 | 16-May-2005 07:20 |
| template comiling problems - need expert debugger! | crq | C++ Forum | 1 | 01-Feb-2005 21:26 |
| C++ file I/O | CronoX | C++ Forum | 36 | 09-Mar-2004 17:28 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The