1. ## Polynomial

Hi I'm working on a program in which I need to have the user input a degree for a polynomial with two variables (x,y) and then input the coefficients for each term. I can't figure out how to output the y exponent, can anyone give me any suggestions?

Code:
```//Exercise Polynomial Part 2
//May 10, 2005

#include <iostream.h>
#include <stdlib.h>

const int arraySize = 7;
void print ( int, int [][arraySize] );
int main ()
{
int power, array [arraySize][arraySize] = {0}, cof;

cout << "What is the degree of your polynomial?\n"
<< "Enter a natural number less than 7: ";
while ( cin >> power && power > 7 || power < 0 )
cout << "\nYou need to pick another number: ";

for ( int i = power; i >= 0; i-- )
{
for ( int j = 0; j <= i; j ++ )
{
cout << "\nEnter the coefficient of x^" << i - j << "y^" << j << ": ";
cin >> cof;
array [i][j] = cof;
}
}

print ( power, array );

system ("PAUSE");
return 0;
}

void print ( int c, int buffer [][arraySize] )
{
cout << endl << buffer [c][c] << "x^" << c << "y^" <<
for ( int i = c

}```

2. according to the first nested for loop the exponent of y can range from 0 to c if c is the exponent of x. Therefore, there is no one exponent of y. If you want to display only the possibility of exponent of y == exponent of x you could just do

cout << buffer[c][c] << "x^" << c << "y^" << c;

If I understand your original code correctly, I think you can display all the possible exponents of y for a give exponent of x as follows, with the corresponding coefficient:

for(i = 0; i <= c; ++i)
cout << buffer[c][i] << "x^" << c << "y^" << i;

3. Thanks a lot but the y part still isn't working, that just gives x and y the same power but they need to add up to that power. thanks though

4. so you want to display all terms where the power of x plus the power of y equal c in the form coeffx^ay^b where a and b are the powers of x and y respectively and coeff is stored in buffer[a][b]? Try this:

for(int i = c; i >= 0; --i)
cout << buffer[i][c - i] << "x^" << i << "y^" << c - i << endl;

5. thank you SOOOO much it works