The purpose of this project is to equip students with skills of manipulating an array as a data structure
to store and process information, using the C++ object structure construct: struct.
The problem is poised as follows: create a data structure to hold a term of a polynomial and then using
the C++ array data structure design a system to manipulate polynomials by being able to:
1. create a polynomial
2. input a polynomial
3. display a polynomial
4. add/subtract two polynomials
5. multiply two polynomials (NB: multiplying by a polynomial of degree 0 is called scalar
The following C++ structure should be used to define a term of a polynomial:
// A polynomial term has two data components:
double coefficient; // The co-efficient of x
int exponent; // The positive integer power of x
Students must then write a system of functions together with the corresponding main function that will
allow the user, using a menu system, to:
1. create a polynomial of his/choice. For example, a call like the following should create a polynomial
x of length 6:
term *x = CreatePolynom ial( /* of length */ 6);
where all the coefficients and exponents are initialised to zero.
2. input data into the polynomial of a given length. For example, the following function call should
allow the user to populate his/her polynomial P of length N:
3. display a polynomial of a given length. For example, the following function call should allow the user
to display his/her polynomial P of length N:
CS 2431 - Prog. Fundamentals Project-01 Due: 1 wk before end of lectures 2007 Page -2/2-
When a polynomial is displayed, terms with zero coefficients must be omitted from the display.
Further, terms with exponents of value 1 should be displayed as: ax, where a is the corresponding
coefficient (and x is understood to be the polynomial variable). Finally, terms with exponents of value
0 should be displayed as just the constant: a. All the other terms should be displayed as: ax^n, where
n is the power of x (x^n means x to the power n).
4. add any two given polynomials. For example, the following function call should allow the user to add
two polynomials: P1 of length N1 and P2 and length N2 and the result being a new polynomial, P:
P = add(P1, N1, /* with */ P2, N2);
Step 4 should be similar when one is subtracting or multiplying any two given polynomials.
NB: Students who could attempt and get right the synthetic division of polynomials will get a bonus
mark of 50 points more
I have been given this problem but i have no idea where to start. can you help me get started.......