Hi , I'm new in C++ programming and I need help. I wanna write a class named polynomial that can be used like this : Code: int main() { vector<double> ac; ac.push_back(10); ac.push_back(3); const Poly a(ac); // a contains 3x + 10 vector<double> bc; bc.push_back(1); bc.push_back(0); bc.push_back(4); const Poly b(bc); // b contains 4x^2 + 1 Poly c = a + b; // c contains 4x^2 + 3x + 11 c += b; // c contains 8x^2 + 3x + 12 Poly d = c * 2; // d contains 16x^2 + 6x + 24 cout << d << endl; // prints 16x^2+6x+24 in the output d = -1 * b; // d contains -4x^2 - 1 cout << d << endl; // prints -4x^2-1 in the output cout << d(2) << endl; // evaluates d with x=2, the result is -17 // same as caling d.operator()(2) cout << d[0] << endl; // prints -1 which is the coefficient of x^0 cout << d[1] << endl; // prints 0 which is the coefficient of x^1 cout << d[2] << endl; // prints -4 which is the coefficient of x^2 cout << d[3] << endl; // prints 0 which is the coefficient of x^3 d[1] = 7; // d now contains -4x^2 + 7x -1 d[4] = 1; // d now contains x^4 - 4x^2 + 7x -1 cout << b[2] << endl; // prints 4 return 0; } and I don't understand how to write inside the member functions. //poly.h class Poly { public: Poly( vector<double> a ):p(a){} Poly& operator+= ( const Poly& c ); //this+=c Poly operator* (); Poly operator+ ( Poly& a ) const; double operator()( const double b ) const; double operator[]( const double d ) const; friend Poly operator<< ( ostream& out , Poly& q ); private: vector<double> p ; }; I think my class should be something like this please help to complete my class. thanks

I some how completed my class and I need help to make it the best plz help me. " code has been attached "

excuse me! are you having fun here or really really wanting to help persons like me solve their problems :-?

I don't understand!!!!!! every one here just had answered the questions for competition and now they won't answer?????(after this )

That is not true from my end because I am member of this forum for quite sometime and yes some people used the competition in the wrong way and I think I had to reply back and cannot sit back see someone bashing on me. Anyways your program is quite good.

ok never mind I made my prject run myself with my friend's help at university. and I won't come here for solving my problems anymore. bye