mardi 4 avril 2017

How can I make a function which sorts exponents when I make a program which makes the sum of two exponential expressions?

I am making a program which makes the sum of two polynomial expressions by using C.

But, I have a problem that I can't make a function which sorts exponents.

For example, each exponent from a polynomial expressions must have only one number which other elements in the expression don't have. For example,

3X^3+4X^2+1X^1+8X^0 => (O)

3X^4+4X^4+5x^2+5X^0 => (X)

So I want to make the exponents have only one special number that other exponents don't have with using ARRAY and RANDOM function.

I heard that Infinite Loop and other random variable (which is necessary to be compare to the array of exponents).

*As is the first element of the first array(first polynomial expression) and *Ae is the last element of the first array. *Bs is the first element of the second array(second polynomial expression) and *Be is the last element of the second array.

The array looks like this : | As | | | | | | | | | | | Ae | Bs | | | | | | | | | | | | | | | | | Be | | | | | | | |

And users should input the number of the elements of the polynomial expression. And random numbers (whose number should be the number of the elements of the polynimial expression) are made and they are inserted to the array.




Aucun commentaire:

Enregistrer un commentaire