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 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* PolynomialStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started