Write a program which can perform addition, subtraction, and multiplication of
singlevariable polynomials with real coefficients in the form: a0 + a1x + a2x
2

…. an1x
n1 + anx
n
.
The input polynomials are entered by a user as strings of characters e.g., 0.867x^23 + 2.45x^23 –
64.654x^11 + 356.897x^24 and this format is mandatory. Note that input polynomials can
contain several terms with the same exponent and terms are not arranged in any particular
order; however, in the resulting polynomial only one term of a given degree can be present and
terms are arranged in the degrees’ ascending order i.e., the output polynomial 15x^7 + 27.3x^2 +
11.8^x – 3x^2 is illegal and should be printed in the form 11.8^x + 24.3x^2 + 15x^7, instead.
Example interaction with the program can look like this:Program: Welcome to the polynomial calculator. Please enter
the first polynomial:
User: 1.485x^15 + 78.945x^3 – 6.48x^5 + 16.43x^3 + 27.845×2
Program: ERROR: Unrecognized character combination: x2. Try
again.
User: 1.485x^15 + 78.945x^3 – 6.48x^5 + 16.43x^3 + 27.845x^2
Program: First polynomial = 27.845x^2 + 95.375x^3 – 6.48x^5 –
1.485x^15
Program: Please enter the second polynomial:
User: 17.85x^27 + 16.483x^5 – 0.765x^2 – 485.637x^15
Program: Second polynomial = 0.765x^2 + 16.483x^5 –
485.637x^15 + 17.85x^27
Program: Choose operation: + (addition), – (subtraction), *
(multiplication)
User: –
Program: Result = 28.61x^2 + 95.375x^3 – 22.963x^5 +
484.152x^15 – 17.85x ^27
Program: Choose: o to perform another operation with the same
arguments, n to enter new arguments, x to exit
User: o
Program: Choose operation: + (addition), – (subtraction), *
(multiplication)
User: *
Program: Result = 21.301425x^4 – 72.961875x^5 + 463.92633x^7 +
1572.0661x^8 – 106.80984x^10 – 13521.426x^17 – 46317.629x^18 +
3122.4505x^20 + 497.03325x^29 + 2423.6147x^30 – 15.668x^32 –
26.50725x^42
Program: Choose: o to perform another operation with the same
arguments, n to enter new arguments, x to exit
User: x
Program: Bye
Source: Windows Questions C++