Question: For user input, spaces between coefficients, operands, exponent and term are optional. For simplicity, you can assume the following in the input format: 1. Coefficients

 For user input, spaces between coefficients, operands, exponent and term are

For user input, spaces between coefficients, operands, exponent and term are optional.

For simplicity, you can assume the following in the input format: 1. Coefficients and exponents are within the range of int type integers. 2. The polynomial is input in the format of decreasing order of exponent, with like-terms combined already.

So, user input could look like these possible situations for example:

1) 4x^3 - 2x^2 + 3x + 1

2) -4x^2 + 4x + 1

3) 4 x ^ 29 + 3 x ^ 9 - 2 x ^ 8 - 2 x ^ 6 + 10 x ^ 2 - x + 1

Since spaces do not matter, please write C++ code that can extract the coefficients and exponents of each term of ANY polynomial where the user inputs a string as the polynomial.

ALSO, library use is very limited, so cstring, cctype, cstdlib, string are alright.

Consider the following implementation declaration for Polynomial using pointers: struct ATerm {int Coefficient; int ATerm* Next; Exponent; typedef ATerm* Polynomial

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!