I am trying to decide how to represent the Polynomialclass. The problems states
ID: 3608637 • Letter: I
Question
I am trying to decide how to represent the Polynomialclass. The problems states that the Polynomial is an array ofterms. Each term has a coefficent and anexponent. Should I have the Polynomial contain an array of PolyTermwhere Class PolyTerm { double coef; int exponent; } Or could I use instead class Polynomial { private: int size; double* coef; } and the index of the coef is the exponent? I am trying to decide how to represent the Polynomialclass. The problems states that the Polynomial is an array ofterms. Each term has a coefficent and anexponent. Should I have the Polynomial contain an array of PolyTermwhere Class PolyTerm { double coef; int exponent; } Or could I use instead class Polynomial { private: int size; double* coef; } and the index of the coef is the exponent?Explanation / Answer
//Hope this will help you.. #include using namespace std; class PolyTerm { private: double coef[100]; int exponent[100]; int len; public: void get() /*take input from user*/ { int i; coutlen; for(i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.