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 }



LinkBack URL
About LinkBacks


