College student here - I'm in Comp Sci II. Just switched professors and feel like I missed out on a lot!! I feel like I missed a big chunk by switching professors and now am very lost.
I'm only just learning about classes and objects, so sorry if some of my questions and mistakes are amateur.
I've put a couple hours into trying to figure out how all of this works for my assignment and attached is what I have so far, which I know is basically a skeleton of what I need. It has all the member functions that I'm suppose to implement and some of them have coding in them.
But man, pass that I'm just clueless!!
Any help will be majorly appreciated, since as I said, I feel extremely out of the loop right now.
Basically with what I have right now, I'm suppose to
~~~~
1)
Write a client program that tests my class Polynomial by allowing the user to input two polynomials P(x) and Q(x) and compute and display their sum, difference, product, and composition as well as evaluate the input polynomial P(x) at a value given by the user.
2)
Write a function that computes the derivative of a polynomial P(x):
Polynomial Derivative(const Polynomial &P)
3)
Write a member function that returns the remainder when the polynomial is divided by a polynomial Q:
Polynomial Modulo(const Polynomial &Q)
Also, include an auxiliary operator overload function for modulo, i.e., that overloads %.
~~~~~~
I'm fairly confident in my header and implementation file, but my main file is most likely wrong with what little is there.
I just need guidance on where to go from here :-\ I really want to understand what's going on here, as I know these are important components.
Yeah, I still need to figure out how to go about with the coding inside a lot of the member functions in my implementation.
Gah, lots of stuff going on in this stuff, hard to keep track of it
And yeah, errors are a part of programming - thanks for letting me know
but halfway down you started to declare raw functions.....
also in your header you have "using namespace std;". This should NEVER be used in a header file. The reason is simple. If anyone, anywhere, anytime includes your header the std namespace is activated. This may not be desired. You should always be explicit "std::string" in header files.
Get the code you have to compile clean. Remember that routines declared to return a value, must return a value, but just put dummies in for now.
Once you get the code to compile, then you can make sure that you instanciate the object properly from main() and can call the routines required to accomplist your tasks. Just put some simple tracing "cout<<"In methon xxx()"<<endl;" in the bodies of the routines to see who is calling who.
Then you can attack the mathematical aspects of each method independantly.
Good Luck.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!) 2008, 2009,2010 In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Thanks Wizard, you're right I'm trying to do too much at once. I'm still learning about how to best debug and start from the bottom up, building to a higher level and more complicated design from basic stuff.
I'm gonna keep working on this - any other help from people is welcome.
Thanks for everything so far!
about how to best debug and start from the bottom up,
The techniques I outlined earlier are actually "top-down". Build the skeleton then fill in the details.
"bootom-up" would involve writing small little programs that proved the implementation for one very small specific detail This can be difficult to do, and typically involves duplication of effort.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!) 2008, 2009,2010 In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
how can u use - operator as -Q for an object . I doubt't putting - sign does not make the coff. part of object -ve.
2.
Code:
Polynomial degree;
cout << "Enter the highest degree of your polynomial: ";
cin >> degree;
Polynomial coefficients[degree];
u overload the >> operator but u had not define Insert opeartor.
degree is object of Polynomial class how can u provede object degree as size of array coeeficients
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.