#include "stdafx.h" #include #include #include using namespace std; class term { friend class polynomial; private: int fact; int pow; public: term(){ fact = 0; pow = 0; } //contractor (null) term(int x,int y){fact = x; pow = y;} //contractor (value) term (term &A){fact = A.fact; pow = A.pow;} //contractor (copy) //function void show() { cout<47 && exp[i]<58) { temp = temp*10 + (exp[i]-48); } else if(pow_flag==false) { if(sign_flag==false) { temp=temp*-1; } cell[count].fact=temp; temp=0; pow_flag=true; sign_flag=true; } } else { if(i!=0) //for check fisrt character is - { cell[count].pow=temp; temp=0; pow_flag=false; count++; } } } clear(); //Add similar sentence with each other } void insert(int fact,int pow) { if(count<20) //Prevent overflow, the "cell" array has 20 components { cell[count].fact=fact; cell[count].pow=pow; count++; } } protected: int power(int num,int pow) { int result=1; for(int i=0;i> (istream &in, polynomial &temp) { string exp; in>>exp; temp.set(exp); return in; } }; int _tmain(int argc, _TCHAR* argv[]) { int selection=0; while(1) { cout<<"---------------- Select an option -------------"<>selection; cout<<"-----------------------------------------------"<>A; cout<<"Enter the first polynomial:"<>B; cout<<"result is: "<>A; cout<<"Enter the first polynomial:"<>B; cout<<"result is: "<>A; cout<<"Enter the variable:"<>b; cout<<"result is: "<>A; cout<<"Enter the index:"<>b; cout<<"result is: "<>A; cout<<"Enter the first polynomial:"<>B; cout<<"result is: "<