hello there, i was hoping someone could help me figure out why my program isn't compiling.
Its a polynomial math program i put together...and with my function "MathPoly" //'d out it compiles just fine....It continually tells me that variables are undeclared and the compiler is crapping out on line 51 right were it gets to the math poly function.
here is my header file:
class polynomial
{
signed int Coeff;
signed int Coeff2;
signed int Exp;
signed int Exp2;
char Var;
char Var2;
public:
Polynomial(){};
void SetCoeff()
{
cout << "enter coefficient of first number"<<endl ;
cin >> Coeff;
}
void SetVar()
{
cout << "enter first variable" <<endl ;
cin >> Var;
}
void SetExp()
{
cout << "enter exponent of first number" <<endl;
cin >> Exp;
}
void SetCoeff2()
{
cout << "enter coefficient of second number"<<endl ;
cin >> Coeff2;
}
void SetVar2()
{
cout << "enter second variable" <<endl ;
cin >> Var2;
}
void SetExp2()
{
cout << "enter exponent of second number" <<endl;
cin >> Exp2;
}
void MathPoly()
{
if (strcmp (Var1, Var2) && Exp1 == Exp2)
{
cout << "sum is" << Coeff1 + Coeff2 << Var1 << "^" << Exp1 << endl;
cout << "difference is" << Coeff1 - Coeff2 << Var1 << "^" << Exp1 << endl;
else
cout << "sum is" << Coeff1 << Var1 << "^" << Exp1 << "+" << Coeff2 << Var2 << "^" << Exp2 << endl;
cout << "difference is" << Coeff1 << Var1 << "^" << Exp1 << "-" << Coeff2 << Var2 << "^" << Exp2 << endl;
}
}
};
Here is my main file
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
#include "ppoly.h"
int main()
{
polynomial poly1;
poly1.SetCoeff();
poly1.SetVar();
poly1.SetExp();
poly1.SetCoeff2();
poly1.SetVar2();
poly1.SetExp2();
poly1.MathPoly();
return 0;
}
Thank you please respond if u know what i'm doing wrong :)