二元多项式计算能够按照指数和升序排列建立并输出多项式;能够完成两个多项式的加法,减法,乘法,并将结果存储于一个新的多项式

1个回答

  • #include #include #include #include using namespace std; class _Item:public pair < int,int > { public:_Item():pair < int,int > (int(),int()){} _Item(int a,int b):pair < int,int > (a,b){} _Item(const _Item &rhs):pair < int,int > (rhs.first,rhs.second){} inline bool operator < (const _Item &other)const { return second < other.second; } inline bool operator==(const _Item &other)const { return second==other.second; } inline bool operator > (const _Item &other)const { return second > other.second; } inline void operator+=(const _Item &other) { first+=other.first; } inline void operator-=(const _Item &other) { first-=other.first; } inline void operator*=(const _Item &other) { first*=other.first; second+=other.second; } void operator=(const _Item &other) { first=other.first; second=other.second; } friend istream &operator>>(istream &is,_Item &it) { is>>it.first>>it.second; return is; } friend ostream &operato