here i am storing intergers using a list structure
to add or minus polynomials
eg.
2x^2 - 3x^1 + 10
5x^2 - 2
coefficents are stored as num.coeff and the powers are stored as num.pwrs.
struct numbers {
int coeff;
int pwrs;
};
numbers num ;
std::list<numbers> poly1 ;
std::list<numbers> poly2 ;
int main () and whatever
num.coeff=z ;
poly1.push_back(num);
num.pwrs = y;
poly1.push_back(num) ;
num.coeff=z ;
poly2.push_back(num);
num.pwrs = y;
poly2.push_back(num) ;
now using iterators how do i get the elements of the same value stored in num.pwrs of poly 1 and poly2 to add or minus??????????
thanks
to add or minus polynomials
eg.
2x^2 - 3x^1 + 10
5x^2 - 2
coefficents are stored as num.coeff and the powers are stored as num.pwrs.
struct numbers {
int coeff;
int pwrs;
};
numbers num ;
std::list<numbers> poly1 ;
std::list<numbers> poly2 ;
int main () and whatever
num.coeff=z ;
poly1.push_back(num);
num.pwrs = y;
poly1.push_back(num) ;
num.coeff=z ;
poly2.push_back(num);
num.pwrs = y;
poly2.push_back(num) ;
now using iterators how do i get the elements of the same value stored in num.pwrs of poly 1 and poly2 to add or minus??????????
thanks