Hi I'm writing a program that is designed to have a user input the degree and coefficients for a polynomial with two variables, x and y, and i'm having trouble figureing out how to output the degree for the y, and tryin to ignore the term if the coefficient is zero. Can anyone help me?
const int arraysize = 7;
void print ( int , int [][arraysize]);
int main()
{
int power, input, array [arraysize][arraysize] = {0};
cout << "What is the degree of your polynomial?"
<< "\nEnter a natural number less than 7: ";
while ( cin >> power && power < 0 || power > 7 )
{
cout << "\nPick another number: ";
}
for ( int i = power; i >= 0; i--)
{
for ( int j = 0; j <= i; j++ )
{
cout << "\nEnter the coefficient for x^" << i - j << "y^" << j << " ";
cin >> input;
array [i][j] = input;
}
}
print ( power, array );
system("PAUSE");
return 0;
}
void print ( int c, int buffer [][arraysize] )
{
if ( c = 0 )
cout << "";
// cout << buffer [c][c] << "x^" << c << "y^" << c;
for ( int i = c - 1; i >= 0; i-- )
{
if ( buffer [c][i] < 0 )
cout << " - ";
else
cout << " + ";
cout << buffer [c][i] << "x^" << c - i << "y^" << i;
}
}