reset password
Author Message
ggonza83
Posts: 14
Posted 02:14 Feb 21, 2015 |

Just needed a little bit of clarification on how we need to properly overload the >> operator. Are we asking for user input for each coefficient that is for a particular degree? Or are we suppose to randomize each coefficient to initialize them in the dynamic array?

khuynh10
Posts: 9
Posted 09:54 Feb 21, 2015 |

Probably taking in user input is better, therefore you can test "==" much easier. 

jwarren6
Posts: 56
Posted 21:15 Feb 21, 2015 |

I did it two ways: user input for degree of polynomial followed by coefficients input AND user input for degree of polynomial followed by randomly-generated coefficients.

kknaur
Posts: 540
Posted 09:25 Feb 22, 2015 |

Once you create a Polynomial using the constructor to get the degree (which should then use the degree + 1 to initialize a dynamic array.)  You can use the >> operator with the freshly created Polynomial object and the user can enter the coefficients.  Be very clear with what order the user should enter the coefficients.  I.E. Should they enter the coefficients so that the highest term coefficient is stored at index 0, or should they enter them so that the lowest term coefficient is stored at index 0.  Otherwise they may enter the numbers and the polynomial will be reversed.

Last edited by kknaur at 09:25 Feb 22, 2015.
jkiyomu
Posts: 27
Posted 19:46 Feb 24, 2015 |

So, the user will input one number at a time or a set of numbers?

kknaur
Posts: 540
Posted 19:54 Feb 24, 2015 |
jkiyomu wrote:

So, the user will input one number at a time or a set of numbers?

What do you mean by one number or a set of numbers? If the operator is written correctly I could type in all the values and press enter, or I could enter a value, press enter, enter the next value, press enter....and so on.

The operator should be responsible for initializing ALL of the values in the coefficient array.

jkiyomu
Posts: 27
Posted 21:30 Feb 24, 2015 |

Thanks that answers my question.