Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Outlook 2023

Authors: James Holler

1st Edition

B0BP9P1VWJ, 979-8367217322

More Books

Students also viewed these Databases questions