mramine364

monomial.cpp

Jul 9th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include "monomial.h"
  2.  
  3. monomial::monomial(double a,int b)
  4. {
  5.     this->coef = a;
  6.     this->deg = b;
  7. }
  8.  
  9. monomial::~monomial()
  10. {
  11. }
  12.  
  13. void monomial::setCoef(double c){
  14.     this->coef = c;
  15. }
  16. double monomial::getCoef() const{
  17.     return this->coef;
  18. }
  19. void monomial::setDeg(int d){
  20.     this->deg = d;
  21. }
  22. int monomial::getDeg() const{
  23.     return this->deg;
  24. }
  25.  
  26. ostream& operator<<(ostream& out, const monomial& m){
  27.     out << m.coef << "*X^" << m.deg;
  28.     return out;
  29. }
Add Comment
Please, Sign In to add comment