Thank you. I fixed that and now it is a disaster.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
#include<iostream>
#include<cmath>
using namespace std;
const int MAXSIZE=10;
class Polynomial
{
private:
int exp;
int Term;
int termsArray[MAXSIZE];
public:
Polynomial()
{
Term=1;
for (int i=0; i<MAXSIZE; i++)
termsArray[i]=0;
}
~Polynomial();
void setPolynomial()
{
int exp;
int nTerm;
int coeff;
cout<<endl<<"Enter the number of terms: ";
cin>>nTerm;
Term = nTerm;
for(int i = 0 ; i < Term ; ++i )
{
cout<<endl<<"TERM # "<< i+1;
cout<<endl<<"Enter the exponent: ";
cin>>exp;
cout<<endl<<"Enter the coefficient: ";
cin>>coeff;
termsArray[exp] = coeff;
}
}
Polynomial operator+(Polynomial P1)
{
Polynomial NewPol1;
for( int exp = 0 ; exp < MAXSIZE ; ++exp)
NewPol1.termsArray[exp] = termsArray[exp] + P1.termsArray[exp] ;
return NewPol1;
}
Polynomial operator-(Polynomial P2)
{
Polynomial NewPol2;
for( int exp = 0 ; exp < MAXSIZE ; ++exp)
NewPol2.termsArray[exp] = termsArray[exp] - P2.termsArray[exp] ;
return NewPol2;}
};
int main()
{
cout << "The program will ask you to enter two polynomials and will add them";
cout << "\n and substract the first one from the second one. " << endl;
Polynomial Pol1, Pol2, Pol3, Pol4;
cout << "\nEnter the parameters the first polynomial.\n";
Pol1.setPolynomial();
cout << "\nEnter the parameters the second polynomial.\n";
Pol2.setPolynomial();
Pol3 = Pol1+Pol2;
cout << Pol3 << endl;
Pol3 = Pol1-Pol2;
cout << Pol4 << endl;
|
There are the endless errors:
Checking file dependency...
\c++\polynomial\PolynomialArray.cpp:76: no match for `_IO_ostream_withassign & << Polynomial &'
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:77: candidates are: class ostream & ostream::operator <<(char)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:78: class ostream & ostream::operator <<(unsigned char)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:79: class ostream & ostream::operator <<(signed char)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:80: class ostream & ostream::operator <<(const char *)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:82: class ostream & ostream::operator <<(const unsigned char *)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:84: class ostream & ostream::operator <<(const signed char *)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:85: class ostream & ostream::operator <<(const void *)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:86: class ostream & ostream::operator <<(int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:87: class ostream & ostream::operator <<(unsigned int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:88: class ostream & ostream::operator <<(long int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:89: class ostream & ostream::operator <<(long unsigned int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:91: class ostream & ostream::operator <<(long long int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:92: class ostream & ostream::operator <<(long long unsigned int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:94: class ostream & ostream::operator <<(short int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:95: class ostream & ostream::operator <<(short unsigned int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:97: class ostream & ostream::operator <<(bool)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:99: class ostream & ostream::operator <<(double)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:100: class ostream & ostream::operator <<(float)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:104: class ostream & ostream::operator <<(long double)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:106: class ostream & ostream::operator <<(ostream & (*)(ostream &))
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:107: class ostream & ostream::operator <<(ios & (*)(ios &))
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:108: class ostream & ostream::operator <<(streambuf *)
c++\polynomial\PolynomialArray.cpp:79: no match for `_IO_ostream_withassign & << Polynomial &'
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:77: candidates are: class ostream & ostream::operator <<(char)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:78: class ostream & ostream::operator <<(unsigned char)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:79: class ostream & ostream::operator <<(signed char)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:80: class ostream & ostream::operator <<(const char *)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:82: class ostream & ostream::operator <<(const unsigned char *)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:84: class ostream & ostream::operator <<(const signed char *)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:85: class ostream & ostream::operator <<(const void *)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:86: class ostream & ostream::operator <<(int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:87: class ostream & ostream::operator <<(unsigned int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:88: class ostream & ostream::operator <<(long int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:89: class ostream & ostream::operator <<(long unsigned int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:91: class ostream & ostream::operator <<(long long int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:92: class ostream & ostream::operator <<(long long unsigned int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:94: class ostream & ostream::operator <<(short int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:95: class ostream & ostream::operator <<(short unsigned int)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:97: class ostream & ostream::operator <<(bool)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:99: class ostream & ostream::operator <<(double)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:100: class ostream & ostream::operator <<(float)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:104: class ostream & ostream::operator <<(long double)
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:106: class ostream & ostream::operator <<(ostream & (*)(ostream &))
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:107: class ostream & ostream::operator <<(ios & (*)(ios &))
[Error] C:\PROGRA~2\C-FREE~1\mingw32\Include\G__~1\iostream.h:108: class ostream & ostream::operator <<(streambuf *)
Complete Make PolynomialArray: 46 error(s), 0 warning(s)