troubleshooting Question

polynomial initialization

Avatar of kuntilanak
kuntilanakFlag for United States of America asked on
Programming Languages-OtherCC++
23 Comments2 Solutions286 ViewsLast Modified:
I used to have the following method:

initPolynomial(int coeff, int power){
//some code here

so if I want to declare x^2 + 2x + 2, I would do this:
x.initPolynomial(1, 2);
x.initPolynomial(2, 1);
x.initPolynomial(2, 0);

I store the coeff and power as a map, value pair. How can I do this so that I don't have to call initiPolynomial several times? Do I need to change the function so that it takes a string and parse it out? If that is the case.. can someone help me out on how to parse the string to a coeff and power

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 23 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 23 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros